-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Copy pathutils.jasmine.ts
69 lines (66 loc) · 1.65 KB
/
utils.jasmine.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
65
66
67
68
69
import { projectFromRc } from './utils';
describe('projectFromRc()', () => {
it('Given `projects.default`, should return default project', () => {
const FIRE_BASE_RC = `{
"targets": {
"project_prod": {
"hosting": {
"app_1": [
"target_1_prod"
],
"app_2": [
"target_2_prod"
]
}
},
"project_stg": {
"hosting": {
"app_1": [
"target_1_stg"
],
"app_2": [
"target_2_stg"
]
}
}
},
"projects": {
"default": "project_stg"
}
}`;
expect(projectFromRc(JSON.parse(FIRE_BASE_RC), 'app_1')).toEqual(['project_stg', 'target_1_stg']);
});
it('Given no `projects.default`, should return first matched project', () => {
const FIRE_BASE_RC = `{
"targets": {
"project_prod": {
"hosting": {
"app_1": [
"target_1_prod"
],
"app_2": [
"target_2_prod"
]
}
},
"project_stg": {
"hosting": {
"app_1": [
"target_1_stg"
],
"app_2": [
"target_2_stg"
]
}
}
}
}`;
expect(projectFromRc(JSON.parse(FIRE_BASE_RC), 'app_1')).toEqual(['project_prod', 'target_1_prod']);
});
it('Given empty targets, return [undefined, undefined]', () => {
const FIRE_BASE_RC = `{
"targets": {}
}`;
expect(projectFromRc(JSON.parse(FIRE_BASE_RC), 'app_1')).toEqual([undefined, undefined]);
});
});