-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmaxFileSizeAll.test.js
40 lines (34 loc) · 1.25 KB
/
maxFileSizeAll.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
'use strict';
const expect = require('chai').expect;
const validators = require('../src/common-validators');
describe('maxFileSizeAll', function() {
const fileList = {
0: {
lastModified: 1459437496451,
lastModifiedDate: 'Thu Mar 31 2016 18:18:16 GMT+0300 (MSK)',
name: '0123456789.png',
size: '1000',
type: 'image/png'
},
1: {
lastModified: 1459437496459,
lastModifiedDate: 'Thu Mar 31 2016 18:18:16 GMT+0300 (MSK)',
name: '01234567890123456789.jpeg',
size: '2000',
type: 'image/jpeg'
},
length: 2
};
it('empty is valid', function() {
expect(validators.maxFileSizeAll(undefined, 2500)).to.be.undefined;
});
it('total files size less then maxFileSizeAll is valid', function() {
expect(validators.maxFileSizeAll(fileList, 3500)).to.be.undefined;
});
it('total file size more then maxFileSizeAll is invalid', function() {
expect(validators.maxFileSizeAll(fileList, 2500)).to.have.property('error');
});
it('total file size equal maxFileSizeAll is valid', function() {
expect(validators.maxFileSizeAll(fileList, 3000)).to.be.undefined;
});
});