|
1 | 1 | const td = require('testdouble')
|
| 2 | +const { describe } = require('yargs') |
2 | 3 |
|
3 | 4 | const providerCodeBuild = require('../../src/ci_providers/provider_codebuild')
|
4 | 5 |
|
@@ -30,64 +31,66 @@ describe('CodeBuild Params', () => {
|
30 | 31 | })
|
31 | 32 | })
|
32 | 33 |
|
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 | + }) |
59 | 61 |
|
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 = { |
63 | 82 | branch: 'branch',
|
64 | 83 | build: 3,
|
| 84 | + buildURL: '', |
| 85 | + commit: 'testsha', |
| 86 | + job: 2, |
65 | 87 | pr: '7',
|
66 |
| - sha: 'testsha', |
| 88 | + service: 'codebuild', |
67 | 89 | 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 | + } |
89 | 91 |
|
90 |
| - const params = providerCodeBuild.getServiceParams(inputs) |
91 |
| - expect(params).toMatchObject(expected) |
| 92 | + const params = providerCodeBuild.getServiceParams(inputs) |
| 93 | + expect(params).toMatchObject(expected) |
| 94 | + }) |
92 | 95 | })
|
93 | 96 | })
|
0 commit comments