From e5cf960bff6d3cb2158ee28cd28098c7c8dc9714 Mon Sep 17 00:00:00 2001 From: OM <25508581+ombharatiya@users.noreply.github.com> Date: Tue, 29 Jun 2021 04:02:57 +0530 Subject: [PATCH] feat: Add state map changes for pending (#43) --- index.js | 10 ++++------ test/index.test.js | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index e271f30..6fd585f 100644 --- a/index.js +++ b/index.js @@ -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...' }; /** @@ -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) => { diff --git a/test/index.test.js b/test/index.test.js index 2e475f2..a268ff9 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -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);