Fix qa-core global teardown
This commit is contained in:
parent
037396babb
commit
7bd7cdcdcf
|
@ -59,11 +59,13 @@ export default class AccountAPI {
|
||||||
return [response, json]
|
return [response, json]
|
||||||
}
|
}
|
||||||
|
|
||||||
async delete(accountID: string, opts: APIRequestOpts = { doExpect: true }) {
|
async delete(accountID: string) {
|
||||||
const [response, json] = await this.client.del(`/api/accounts/${accountID}`)
|
const [response, json] = await this.client.del(`/api/accounts/${accountID}`, {
|
||||||
|
internal: true,
|
||||||
if (opts.doExpect) {
|
})
|
||||||
expect(response).toHaveStatusCode(200)
|
// can't use expect here due to use in global teardown
|
||||||
|
if (response.status !== 204) {
|
||||||
|
throw new Error(`Could not delete accountId=${accountID}`)
|
||||||
}
|
}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ async function deleteAccount() {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const accountID = global.qa.accountId
|
const accountID = global.qa.accountId
|
||||||
// can't run 'expect' blocks in teardown
|
// can't run 'expect' blocks in teardown
|
||||||
await accountsApi.accounts.delete(accountID, { doExpect: false })
|
await accountsApi.accounts.delete(accountID)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function teardown() {
|
async function teardown() {
|
||||||
|
|
Loading…
Reference in New Issue