Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4493445

Browse files
committed
Update test
1 parent 9152982 commit 4493445

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

tests/unit/vue-file-preview.vue.spec.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,30 @@ import FileData from '@/lib/file-data'
33
import helper from './helper'
44

55
describe('vue-file-preview.vue', () => {
6+
7+
var rawFileData = {
8+
"name":"sample.pdf",
9+
"lastModified":1565232623243,
10+
// "sizeText":"3 KB",
11+
"size":3028,
12+
"type":"application/pdf",
13+
"ext":"pdf"
14+
};
15+
616
it('renders FileData when passed', () => {
7-
var fileData = new FileData({
8-
"name":"sample.pdf",
9-
"lastModified":1565232623243,
10-
// "sizeText":"3 KB",
11-
"size":3028,
12-
"type":"application/pdf",
13-
"ext":"pdf"
14-
});
17+
var fileData = new FileData(rawFileData);
18+
var wrapper = helper.getWrapper(VueFilePreview, {
19+
value: fileData,
20+
}, {})
21+
expect(helper.getText(wrapper, '.file-name')).toBe('sample')
22+
expect(helper.getText(wrapper, '.file-ext')).toBe('pdf')
23+
expect(helper.getText(wrapper, '.file-size')).toBe('3 KB')
24+
});
25+
26+
it('renders raw FileData when passed', () => {
27+
var fileData = rawFileData;
1528
var wrapper = helper.getWrapper(VueFilePreview, {
16-
fileData: fileData,
29+
value: fileData,
1730
}, {})
1831
expect(helper.getText(wrapper, '.file-name')).toBe('sample')
1932
expect(helper.getText(wrapper, '.file-ext')).toBe('pdf')

0 commit comments

Comments
 (0)