Skip to content

Commit

Permalink
feat: Add state map changes for pending (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
ombharatiya authored Jun 28, 2021
1 parent fbf7c5f commit e5cf960
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
10 changes: 4 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,13 @@ const MATCH_COMPONENT_ROOTDIR = 5;

const STATE_MAP = {
SUCCESS: 'success',
RUNNING: 'running',
QUEUED: 'pending'
PENDING: 'pending',
FAILURE: 'failed'
};
const DESCRIPTION_MAP = {
SUCCESS: 'Everything looks good!',
FAILURE: 'Did not work as expected.',
ABORTED: 'Aborted mid-flight',
RUNNING: 'Testing your code...',
QUEUED: 'Looking for a place to park...'
PENDING: 'Parked it as Pending...'
};

/**
Expand Down Expand Up @@ -977,7 +975,7 @@ class GitlabScm extends Scm {
qs: {
context: statusTitle,
description: description || DESCRIPTION_MAP[buildStatus],
state: STATE_MAP[buildStatus] || 'failure',
state: STATE_MAP[buildStatus] || 'failed',
target_url: url
}
}).then((response) => {
Expand Down
6 changes: 3 additions & 3 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1329,10 +1329,10 @@ describe('index', function () {
);

it('successfully update status with correct values', () => {
config.buildStatus = 'ABORTED';
config.buildStatus = 'FAILURE';
expectedOptions.qs.context = 'Screwdriver/675/main';
expectedOptions.qs.state = 'failure';
expectedOptions.qs.description = 'Aborted mid-flight';
expectedOptions.qs.state = 'failed';
expectedOptions.qs.description = 'Did not work as expected.';

return scm.updateCommitStatus(config).then(() => {
assert.calledWith(requestMock, expectedOptions);
Expand Down

0 comments on commit e5cf960

Please sign in to comment.