-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinputs.test.js
29 lines (26 loc) · 1.71 KB
/
inputs.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
const inputs = require('./inputs');
describe ('Parse Owners', () => {
test('all keys', async () => {
const {maintainers, areaReviewers, areaApprovers} = inputs.parseOwners('testdata/owners.yml');
expect(maintainers).toEqual(['ted']);
expect(areaReviewers.get('area/area-1')).toEqual(expect.arrayContaining(['alice', 'bob']));
expect(areaReviewers.get('area/area-2')).toEqual(expect.arrayContaining(['bob', 'john']));
expect(areaApprovers.get('area/area-1')).toEqual(expect.arrayContaining(['alice', 'bob']));
expect(areaApprovers.get('area/area-2')).toEqual(expect.arrayContaining(['bob', 'john']));
});
test('missing approvers', async () => {
const {maintainers, areaReviewers, areaApprovers} = inputs.parseOwners('testdata/owners-without-approvers.yml');
expect(maintainers).toEqual(['ted']);
expect(areaReviewers.get('area/area-1')).toEqual(expect.arrayContaining(['alice', 'bob']));
expect(areaReviewers.get('area/area-2')).toEqual(expect.arrayContaining(['bob', 'john']));
expect(areaApprovers).toEqual(new Map());
});
test('missing maintainers', async () => {
const {maintainers, areaReviewers, areaApprovers} = inputs.parseOwners('testdata/owners-without-maintainers.yml');
expect(maintainers).toEqual([]);
expect(areaReviewers.get('area/area-1')).toEqual(expect.arrayContaining(['alice', 'bob']));
expect(areaReviewers.get('area/area-2')).toEqual(expect.arrayContaining(['bob', 'john']));
expect(areaApprovers.get('area/area-1')).toEqual(expect.arrayContaining(['alice', 'bob']));
expect(areaApprovers.get('area/area-2')).toEqual(expect.arrayContaining(['bob', 'john']));
});
});