Add a test for the precedence

Signed-off-by: Robert Schuh <github@eneticum.de>
This commit is contained in:
Robert Schuh
2022-09-03 03:16:48 +02:00
committed by Robert Schuh
parent 6e06c1d1ab
commit d2ca018f43
@@ -42,6 +42,13 @@ describe('bitbucketServer core', () => {
username: 'u',
password: 'p',
};
const withBasicAuthAndTokenPrecedence: BitbucketServerIntegrationConfig = {
host: '',
apiBaseUrl: '',
token: 'A',
username: 'u',
password: 'p',
};
const withoutCredentials: BitbucketServerIntegrationConfig = {
host: '',
apiBaseUrl: '',
@@ -54,6 +61,10 @@ describe('bitbucketServer core', () => {
(getBitbucketServerRequestOptions(withBasicAuth).headers as any)
.Authorization,
).toEqual('Basic dTpw');
expect(
(getBitbucketServerRequestOptions(withBasicAuthAndTokenPrecedence).headers as any)
.Authorization,
).toEqual('Bearer A');
expect(
(getBitbucketServerRequestOptions(withoutCredentials).headers as any)
.Authorization,