Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { mount } from '@vue/test-utils';
import { expect, describe, it, vi, beforeEach } from 'vitest';
import CardNotifList from '@/components/card/CardNotifList.vue';
import { UserNotification } from '@/common/models';
/*
* Mocking Vue Router ( useRouter() ) and this should in root.
* You can't put vi.mock() inside of describe() or test().
*/
const vueRouterMock = vi.fn();
vi.mock('vue-router', () => ({
useRouter: () => ({
push: vueRouterMock,
go: vueRouterMock,
}),
}));
/*
* Reset All mocking data for fresh context
*/
beforeEach(() => { vi.restoreAllMocks() })
describe("Notification Test", () => {
it("Should Exists", () => {
expect(CardNotifList).toBeTruthy();
})
it("Render with By Props", () => {
const notif: UserNotification = {
title: "New interest for [HIKQVNL8] Villa K",
message: "Taylor Swift has expressed interest in [HIKQVNL8] Villa K. Please review it at https://admin.briix.com.",
createdAt: "2022-11-16T05:21:15.206244Z",
read: true,
code: "1Xn55q3wDAhtDPFHIxNba3",
kind: "T",
codeKind: "LYLACS,PR-SZTLCY7J"
}
const wrapper = mount(CardNotifList, {
props: {
notif: notif
},
global: {
mocks: {
formatDateFromNow: () => { }
}
}
})
expect(wrapper.text()).toContain(notif.message)
})
}) |