Skip to content

Commit

Permalink
test: accelerate end2end device flow tests
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Oct 7, 2024
1 parent cd5bbc1 commit 3baa96c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tap/end2end-device-code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default (QUnit: QUnit) => {
})

let result = await lib.processDeviceAuthorizationResponse(as, client, response)
const { verification_uri_complete, device_code } = result
const { verification_uri_complete, device_code, interval = 5 } = result

await fetch('http://localhost:3000/drive', {
method: 'POST',
Expand All @@ -63,7 +63,7 @@ export default (QUnit: QUnit) => {
try {
result = await processDeviceCodeResponse()
} catch {
await new Promise((resolve) => setTimeout(resolve, 100))
await new Promise((resolve) => setTimeout(resolve, interval * 1000))
response = await deviceCodeGrantRequest()
}
}
Expand Down
3 changes: 3 additions & 0 deletions tap/server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ provider.use(async (ctx, next) => {
if (typeof ctx.body === 'string' && ctx.body.includes('Continue')) {
ctx.body = ctx.body.replace('<title>Sign-in</title>', '<title>Consent</title>')
}
if (ctx.body?.verification_uri_complete) {
ctx.body.interval = 0.1
}
}
})

Expand Down

0 comments on commit 3baa96c

Please sign in to comment.