From d2ca018f4372fffabac1fe72727038400652d358 Mon Sep 17 00:00:00 2001 From: Robert Schuh Date: Sat, 3 Sep 2022 03:16:48 +0200 Subject: [PATCH] Add a test for the precedence Signed-off-by: Robert Schuh --- packages/integration/src/bitbucketServer/core.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/integration/src/bitbucketServer/core.test.ts b/packages/integration/src/bitbucketServer/core.test.ts index de18dcd821..5184d14ba7 100644 --- a/packages/integration/src/bitbucketServer/core.test.ts +++ b/packages/integration/src/bitbucketServer/core.test.ts @@ -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,