Skip to content

Commit

Permalink
🌋
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Dec 5, 2022
1 parent 5892f9a commit 216aaf8
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/chatgpt-api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,6 @@ test('ChatGPTAPI invalid session token', async (t) => {
)
})

test('ChatGPTAPI expired session token', async (t) => {
if (isCI) {
return
}

const expiredSessionToken = process.env.TEST_EXPIRED_SESSION_TOKEN

await t.throwsAsync(
async () => {
const chatgpt = new ChatGPTAPI({ sessionToken: expiredSessionToken })
await chatgpt.ensureAuth()
},
{
message:
'ChatGPT failed to refresh auth token. Error: session token has expired'
}
)
})

test('ChatGPTAPI valid session token', async (t) => {
if (!isCI) {
t.timeout(2 * 60 * 1000) // 2 minutes
Expand All @@ -67,3 +48,20 @@ test('ChatGPTAPI valid session token', async (t) => {
})()
)
})

if (!isCI) {
test('ChatGPTAPI expired session token', async (t) => {
const expiredSessionToken = process.env.TEST_EXPIRED_SESSION_TOKEN

await t.throwsAsync(
async () => {
const chatgpt = new ChatGPTAPI({ sessionToken: expiredSessionToken })
await chatgpt.ensureAuth()
},
{
message:
'ChatGPT failed to refresh auth token. Error: session token has expired'
}
)
})
}

0 comments on commit 216aaf8

Please sign in to comment.