Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Apr 27, 2021
1 parent 32f22e7 commit 9a72398
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/server/lib/util/ci_provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ const _providerCiParams = () => {
'LAYERCI_REPO_NAME',
'LAYERCI_REPO_OWNER',
'LAYERCI_BRANCH',
'GIT_TAG',
'GIT_TAG', // short hex for commits
]),
}
}
Expand Down
37 changes: 37 additions & 0 deletions packages/server/test/unit/ci_provider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,43 @@ describe('lib/util/ci_provider', () => {
})
})

it('layerci', () => {
resetEnv = mockedEnv({
LAYERCI: 'true',

LAYERCI_JOB_ID: 'jobId',
LAYERCI_RUNNER_ID: 'runnerId',
RETRY_INDEX: 'retryIndex',

// git info
LAYERCI_PULL_REQUEST: 'pullRequest',
LAYERCI_REPO_NAME: 'repoName',
LAYERCI_REPO_OWNER: 'repoOwner',
LAYERCI_BRANCH: 'branch',
GIT_TAG: 'tag',
GIT_COMMIT: 'commit',
GIT_COMMIT_TITLE: 'commitTitle',
}, { clear: true })

expectsName('layerci')
expectsCiParams({
layerciJobId: 'jobId',
layerciRunnerId: 'runnerId',
retryIndex: 'retryIndex',
gitTag: 'tag',
layerciBranch: 'branch',
layerciPullRequest: 'pullRequest',
layerciRepoName: 'repoName',
layerciRepoOwner: 'repoOwner',
})

return expectsCommitParams({
sha: 'commit',
branch: 'branch',
message: 'commitTitle',
})
})

it('azure', () => {
resetEnv = mockedEnv({
// these two variables tell us it is Azure CI
Expand Down

0 comments on commit 9a72398

Please sign in to comment.