-
Notifications
You must be signed in to change notification settings - Fork 200
Expand file tree
/
Copy pathdeploymentConfig.test.js
More file actions
62 lines (55 loc) · 1.47 KB
/
deploymentConfig.test.js
File metadata and controls
62 lines (55 loc) · 1.47 KB
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
const DeploymentConfig = require('../../../lib/deploymentConfig')
const defaultConfig = {
configvalidators: {},
overridevalidators: {},
restrictedRepos: ['admin', '.github', 'safe-settings']
}
const context = { log: { info: jest.fn() } }
describe('no deploymentConfig', () => {
const deploymentConfig = new DeploymentConfig(context, 'nonexistent.yml')
test('matches default config', () => {
expect(deploymentConfig).toMatchObject(defaultConfig)
})
test('outputs info message', () => {
expect(context.log.info).toHaveBeenCalledWith('No deployment settings found at nonexistent.yml')
})
})
describe('sample deploymentConfig', () => {
const deploymentConfig = new DeploymentConfig(context, './docs/sample-settings/sample-deployment-settings.yml')
test('matches snapshot', () => {
expect(deploymentConfig).toMatchInlineSnapshot(`
DeploymentConfig {
"configvalidators": {
"collaborators": {
"error": "\`Admin cannot be assigned to collaborators\`
",
"isValid": [Function],
},
},
"overridevalidators": {
"branches": {
"canOverride": [Function],
"error": "\`Branch protection required_approving_review_count cannot be overidden to a lower value\`
",
},
"labels": {
"canOverride": [Function],
"error": "Some error
",
},
},
"restrictedRepos": {
"exclude": [
"^admin$",
"^\\.github$",
"^safe-settings$",
".*-test",
],
"include": [
"^test$",
],
},
}
`)
})
})