자주 μ‚¬μš©ν•˜λŠ” API λͺ©λ‘

λ‹¨μœ„ ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€ μž‘μ„±μ„ μœ„ν•΄ 자주 μ‚¬μš©ν•˜λŠ” API λͺ©λ‘μž…λ‹ˆλ‹€.

Shallow Rendering

ν…ŒμŠ€νŠΈ ν•  μ»΄ν¬λ„ŒνŠΈμ˜ κΈ°λŠ₯만 ν…ŒμŠ€νŠΈν•˜κ³  ν•˜μœ„ μ»΄ν¬λ„ŒνŠΈμ™€λŠ” λΆ„λ¦¬ν•΄μ£ΌλŠ” ν…ŒμŠ€νŠΈ API

import { shallowMount } from '@vue/test-utils'
import Component from './component'

describe('Component', () => {
  test('is a Vue instance', () => {
    const wrapper = shallowMount(Component);
    expect(wrapper.isVueInstance()).toBeTruthy();
  })
})

mount a component without rendering its child components

Mount

ν…ŒμŠ€νŠΈν•  μ»΄ν¬λ„ŒνŠΈμ˜ ν•˜μœ„ μ»΄ν¬λ„ŒνŠΈμ˜ λ™μž‘κΉŒμ§€ ν•¨κ»˜ ν…ŒμŠ€νŠΈ ν•˜λŠ” API

// helloworld.test.js
import { mount } from '@vue/test-utils';
import HelloWorld from './HelloWorld.vue';

test('HelloWorld Component', () => {
  const wrapper = mount(HelloWorld);
  expect(wrapper.vm.message).toBe('Vue!');
});