Skip to content

Commit

Permalink
Fix windows test
Browse files Browse the repository at this point in the history
  • Loading branch information
pkukielka committed Jan 14, 2025
1 parent 70abf16 commit 92c47ec
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/shared/src/configuration/auth-resolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ describe('auth-resolver', () => {
})

test('resolve custom auth provider', async () => {
const credentialsJson = JSON.stringify({
headers: { Authorization: 'token X' },
expiration: 1337,
})

const auth = await resolveAuth(
'sourcegraph.com',
{
Expand All @@ -69,9 +74,9 @@ describe('auth-resolver', () => {
endpoint: 'https://my-server.com',
executable: {
commandLine: [
'echo \'{ "headers": { "Authorization": "token X" }, "expiration": 2222222222 }\'',
isWindows() ? `echo ${credentialsJson}` : `echo '${credentialsJson}'`,
],
shell: isWindows() ? 'true' : '/bin/bash',
shell: isWindows() ? process.env.ComSpec : '/bin/bash',
timeout: 5000,
windowsHide: true,
},
Expand All @@ -86,7 +91,7 @@ describe('auth-resolver', () => {
expect(auth.serverEndpoint).toBe('https://my-server.com/')

const headerCredential = auth.credentials as HeaderCredential
expect(headerCredential.expiration).toBe(2222222222)
expect(headerCredential.expiration).toBe(1337)
expect(headerCredential.getHeaders()).toStrictEqual({
Authorization: 'token X',
})
Expand Down

0 comments on commit 92c47ec

Please sign in to comment.