forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_size_data_spec.ts
64 lines (59 loc) · 1.42 KB
/
file_size_data_spec.ts
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
60
61
62
63
64
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {FileSizeData, omitCommonPathPrefix, sortFileSizeData} from './file_size_data';
describe('file size data', () => {
it('should be able to properly omit the common path prefix', () => {
const data: FileSizeData = {
unmapped: 0,
files: {
size: 3,
'parent/': {
size: 3,
'parent2/': {
size: 3,
'a/': {
size: 3,
'file.ts': 3,
},
'b/': {
size: 0,
}
}
}
}
};
expect(omitCommonPathPrefix(data.files)).toEqual({
size: 3,
'a/': {
size: 3,
'file.ts': 3,
},
'b/': {
size: 0,
}
});
});
it('should be able to properly sort file size data in alphabetical order', () => {
const data: FileSizeData = {
unmapped: 0,
files: {
size: 7,
'b/': {'c.ts': 3, 'a.ts': 3, size: 6},
'a/': {'nested/': {size: 1, 'a.ts': 1}, size: 1},
}
};
expect(sortFileSizeData(data)).toEqual({
unmapped: 0,
files: {
size: 7,
'a/': {size: 1, 'nested/': {size: 1, 'a.ts': 1}},
'b/': {size: 6, 'a.ts': 3, 'c.ts': 3},
},
});
});
});