Fix qa-core teardown

This commit is contained in:
Rory Powell 2023-06-09 20:58:42 +01:00
parent b1287d6a9f
commit 25fc792d24
2 changed files with 7 additions and 3 deletions

View File

@ -59,9 +59,12 @@ export default class AccountAPI {
return [response, json] return [response, json]
} }
async delete(accountID: string) { async delete(accountID: string, opts: APIRequestOpts = { doExpect: true }) {
const [response, json] = await this.client.del(`/api/accounts/${accountID}`) const [response, json] = await this.client.del(`/api/accounts/${accountID}`)
expect(response).toHaveStatusCode(200)
if (opts.doExpect) {
expect(response).toHaveStatusCode(200)
}
return response return response
} }
} }

View File

@ -10,7 +10,8 @@ const API_OPTS: APIRequestOpts = { doExpect: false }
async function deleteAccount() { async function deleteAccount() {
// @ts-ignore // @ts-ignore
const accountID = global.qa.accountId const accountID = global.qa.accountId
await accountsApi.accounts.delete(accountID) // can't run 'expect' blocks in teardown
await accountsApi.accounts.delete(accountID, { doExpect: false })
} }
async function teardown() { async function teardown() {