Skip to content

Commit b3d45fe

Browse files
committed
fix: send proper data to authorizer lambda for e2e tests
1 parent 875fb0d commit b3d45fe

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/test/setupUtil.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ export function skipTest(testOrCtx: Mocha.Context | Mocha.Test | undefined, reas
6060
let test
6161

6262
if (testOrCtx?.type === 'test') {
63-
test = (testOrCtx as Mocha.Test)
63+
test = testOrCtx as Mocha.Test
6464
} else {
65-
const context = (testOrCtx as Mocha.Context | undefined)
65+
const context = testOrCtx as Mocha.Context | undefined
6666
test = context?.currentTest ?? context?.test
6767
}
6868

@@ -222,10 +222,17 @@ export function registerAuthHook(secret: string, lambdaId = process.env['AUTH_UT
222222

223223
const openStub = patchObject(vscode.env, 'openExternal', async target => {
224224
try {
225+
const url = new URL(target.toString(true))
226+
const userCode = url.searchParams.get('user_code')
227+
228+
// TODO: Update this to just be the full URL if the authorizer lambda ever
229+
// supports the verification URI with user code embedded (VerificationUriComplete).
230+
const verificationUri = url.origin
231+
225232
await invokeLambda(lambdaId, {
226233
secret,
227-
userCode: await vscode.env.clipboard.readText(),
228-
verificationUri: target.toString(),
234+
userCode,
235+
verificationUri,
229236
})
230237
} finally {
231238
openStub.dispose()

0 commit comments

Comments
 (0)