Skip to content

Commit bccc300

Browse files
committed
add tests
1 parent 2ee9ccb commit bccc300

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { createLocalVue } from '@vue/test-utils';
2+
import ToastLayoutDefault from './toast_layout_default.vue';
3+
4+
const testContext = {};
5+
6+
describe('Toast Default Layout Tests', () => {
7+
beforeAll(() => {
8+
testContext.localVue = createLocalVue();
9+
});
10+
11+
describe('Validation Tests', () => {
12+
describe('Role Validator', () => {
13+
const MOCK_PROP = ToastLayoutDefault.props.role;
14+
15+
describe('When provided role is in TOAST_ROLES', () => {
16+
it('passes custom prop validation', () => {
17+
expect(MOCK_PROP.validator(MOCK_PROP.default)).toBe(true);
18+
});
19+
});
20+
21+
describe('When provided role is not in TOAST_ROLES', () => {
22+
it('fails custom prop validation', () => {
23+
expect(MOCK_PROP.validator(`INVALID_ROLE`)).toBe(false);
24+
});
25+
});
26+
});
27+
28+
describe('Kind Validator', () => {
29+
const MOCK_PROP = ToastLayoutDefault.props.kind;
30+
31+
describe('When provided kind is in NOTICE_KINDS', () => {
32+
it('passes custom prop validation', () => {
33+
expect(MOCK_PROP.validator(MOCK_PROP.default)).toBe(true);
34+
});
35+
});
36+
37+
describe('When provided kind is not in NOTICE_KINDS', () => {
38+
it('fails custom prop validation', () => {
39+
expect(MOCK_PROP.validator(`INVALID_KIND`)).toBe(false);
40+
});
41+
});
42+
});
43+
});
44+
});

0 commit comments

Comments
 (0)