Skip to content

Commit 4d0d098

Browse files
authored
fix(3384): Failure to get user info from scm should not throw error (#101)
1 parent 605904c commit 4d0d098

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
"screwdriver-data-schema": "^25.0.0",
5353
"screwdriver-logger": "^3.0.0",
5454
"screwdriver-request": "^3.0.0",
55-
"screwdriver-scm-base": "^10.0.0"
55+
"screwdriver-scm-base": "^10.0.1"
5656
}
5757
}

test/index.test.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -533,22 +533,28 @@ describe('index', function () {
533533
});
534534
});
535535

536-
it('rejects if fails', () => {
536+
it('resolves with author with default values for the optional fields when there is a failure', () => {
537537
const err = new Error('Bitbucket API error');
538+
const username = '{4f1a9b7f-586e-4e80-b9eb-a7589b4a165f}';
538539

539540
requestMock.rejects(err);
540541

541542
return scm
542543
.decorateAuthor({
543-
username: '{4f1a9b7f-586e-4e80-b9eb-a7589b4a165f}',
544+
username,
544545
token
545546
})
546-
.then(() => {
547-
assert.fail('Should not get here');
548-
})
549-
.catch(error => {
550-
assert.calledWith(requestMock, expectedOptions);
551-
assert.equal(error, err);
547+
.then(author => {
548+
assert.deepEqual(
549+
{
550+
id: '',
551+
avatar: 'https://cd.screwdriver.cd/assets/unknown_user.png',
552+
name: username,
553+
username,
554+
url: 'https://cd.screwdriver.cd/'
555+
},
556+
author
557+
);
552558
});
553559
});
554560
});

0 commit comments

Comments
 (0)