Skip to content

Commit d5ba10e

Browse files
committed
test: wrap in describe block
1 parent 16f6347 commit d5ba10e

File tree

1 file changed

+56
-53
lines changed

1 file changed

+56
-53
lines changed
Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const td = require('testdouble')
2+
const { describe } = require('yargs')
23

34
const providerCodeBuild = require('../../src/ci_providers/provider_codebuild')
45

@@ -30,64 +31,66 @@ describe('CodeBuild Params', () => {
3031
})
3132
})
3233

33-
it('gets correct params', () => {
34-
const inputs = {
35-
args: {},
36-
envs: {
37-
CI: true,
38-
CODEBUILD_CI: true,
39-
CODEBUILD_WEBHOOK_HEAD_REF: 'refs/heads/master',
40-
CODEBUILD_RESOLVED_SOURCE_VERSION: 'testingsha',
41-
CODEBUILD_BUILD_ID: 2,
42-
CODEBUILD_SOURCE_VERSION: 'pr/1',
43-
CODEBUILD_SOURCE_REPO_URL: 'https://github.com/repo.git',
44-
},
45-
}
46-
const expected = {
47-
branch: 'master',
48-
build: 2,
49-
buildURL: '',
50-
commit: 'testingsha',
51-
job: 2,
52-
pr: '1',
53-
service: 'codebuild',
54-
slug: 'repo',
55-
}
56-
const params = providerCodeBuild.getServiceParams(inputs)
57-
expect(params).toMatchObject(expected)
58-
})
34+
describe('getServiceParams()', () => {
35+
it('gets correct params', () => {
36+
const inputs = {
37+
args: {},
38+
envs: {
39+
CI: true,
40+
CODEBUILD_CI: true,
41+
CODEBUILD_WEBHOOK_HEAD_REF: 'refs/heads/master',
42+
CODEBUILD_RESOLVED_SOURCE_VERSION: 'testingsha',
43+
CODEBUILD_BUILD_ID: 2,
44+
CODEBUILD_SOURCE_VERSION: 'pr/1',
45+
CODEBUILD_SOURCE_REPO_URL: 'https://github.com/repo.git',
46+
},
47+
}
48+
const expected = {
49+
branch: 'master',
50+
build: 2,
51+
buildURL: '',
52+
commit: 'testingsha',
53+
job: 2,
54+
pr: '1',
55+
service: 'codebuild',
56+
slug: 'repo',
57+
}
58+
const params = providerCodeBuild.getServiceParams(inputs)
59+
expect(params).toMatchObject(expected)
60+
})
5961

60-
it('gets correct params for overrides', () => {
61-
const inputs = {
62-
args: {
62+
it('gets correct params for overrides', () => {
63+
const inputs = {
64+
args: {
65+
branch: 'branch',
66+
build: 3,
67+
pr: '7',
68+
sha: 'testsha',
69+
slug: 'testOrg/testRepo',
70+
},
71+
envs: {
72+
CI: true,
73+
CODEBUILD_CI: true,
74+
CODEBUILD_WEBHOOK_HEAD_REF: 'refs/heads/master',
75+
CODEBUILD_RESOLVED_SOURCE_VERSION: 'testingsha',
76+
CODEBUILD_BUILD_ID: 2,
77+
CODEBUILD_SOURCE_VERSION: 'pr/1',
78+
CODEBUILD_SOURCE_REPO_URL: 'https://github.com/repo.git',
79+
},
80+
}
81+
const expected = {
6382
branch: 'branch',
6483
build: 3,
84+
buildURL: '',
85+
commit: 'testsha',
86+
job: 2,
6587
pr: '7',
66-
sha: 'testsha',
88+
service: 'codebuild',
6789
slug: 'testOrg/testRepo',
68-
},
69-
envs: {
70-
CI: true,
71-
CODEBUILD_CI: true,
72-
CODEBUILD_WEBHOOK_HEAD_REF: 'refs/heads/master',
73-
CODEBUILD_RESOLVED_SOURCE_VERSION: 'testingsha',
74-
CODEBUILD_BUILD_ID: 2,
75-
CODEBUILD_SOURCE_VERSION: 'pr/1',
76-
CODEBUILD_SOURCE_REPO_URL: 'https://github.com/repo.git',
77-
},
78-
}
79-
const expected = {
80-
branch: 'branch',
81-
build: 3,
82-
buildURL: '',
83-
commit: 'testsha',
84-
job: 2,
85-
pr: '7',
86-
service: 'codebuild',
87-
slug: 'testOrg/testRepo',
88-
}
90+
}
8991

90-
const params = providerCodeBuild.getServiceParams(inputs)
91-
expect(params).toMatchObject(expected)
92+
const params = providerCodeBuild.getServiceParams(inputs)
93+
expect(params).toMatchObject(expected)
94+
})
9295
})
9396
})

0 commit comments

Comments
 (0)