-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathcomponent.test.js
59 lines (45 loc) · 1.66 KB
/
component.test.js
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
54
55
56
57
58
59
'use strict';
const packPath = process.env.TEST_LIB ? '../lib/json-editor.min.js' : '../src/JsonEditor.vue';
const pack = require(packPath);
const JsonEditor = pack.default;
describe('JsonEditor', () => {
describe('hook', () => {
it('should have a created hook', () => {
expect(typeof JsonEditor.created).toBe('function');
});
it('should have a mounted hook', () => {
expect(typeof JsonEditor.mounted).toBe('function');
});
});
describe('method', () => {
it('should have a changed method', () => {
expect(typeof JsonEditor.methods.changed).toBe('function');
});
it('should have a input method', () => {
expect(typeof JsonEditor.methods.input).toBe('function');
});
it('should have a reset method', () => {
expect(typeof JsonEditor.methods.reset).toBe('function');
});
it('should have a submit method', () => {
expect(typeof JsonEditor.methods.submit).toBe('function');
});
it('should have a setErrorMessage method', () => {
expect(typeof JsonEditor.methods.setErrorMessage).toBe('function');
});
it('should have a clearErrorMessage method', () => {
expect(typeof JsonEditor.methods.clearErrorMessage).toBe('function');
});
});
describe('data', () => {
// Evaluate the results of functions in
// the raw component options
it('should set the correct default data', () => {
expect(typeof JsonEditor.data).toBe('function');
const defaultData = JsonEditor.data();
expect(Object.keys(defaultData.default).length).toBe(0);
// expect(defaultData.fields.length).toBe(0);
expect(defaultData.error).toBe(null);
});
});
});