# ์์ฃผ ์ฌ์ฉํ๋ 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!');
});
โ Tutorial - Todo App Snapshots โ