Skip to content

Commit

Permalink
feat: 单元测试
Browse files Browse the repository at this point in the history
  • Loading branch information
yangxiaolu1993 committed Apr 18, 2022
1 parent af7fc35 commit 6e9e1c1
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion src/packages/__VUE/comment/__tests__/comment.spec.ts
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
import { mount } from '@vue/test-utils';
import { config, mount } from '@vue/test-utils';
import { nextTick, toRefs, reactive } from 'vue';
import NutIcon from '../../icon/index.vue';
import NutRate from '../../rate/index.vue';
import Comment from '../index.vue';
// import { Sku as SkuData, Goods } from '../data';
import CommentData from '../comment_data.json';

beforeAll(() => {
config.global.components = {
NutIcon,
NutRate
};
});

afterAll(() => {
config.global.components = {};
});

test('comment init render', async () => {
const wrapper = mount(Comment, {
props: {
images: CommentData.Comment.images,
videos: CommentData.Comment.videos,
info: CommentData.Comment.info
}
});
await nextTick();
expect(wrapper.find('.nut-comment__main').exists()).toBeTruthy();
});

test('comment mutli images', async () => {
const wrapper = mount(Comment, {
props: {
headerType: 'complex',
imagesRows: 'multi',
images: CommentData.Comment.images,
videos: CommentData.Comment.videos,
info: CommentData.Comment.info
}
});
await nextTick();
expect(wrapper.find('.nut-comment-images__mask').exists()).toBeTruthy();
});

0 comments on commit 6e9e1c1

Please sign in to comment.