Skip to content

Commit

Permalink
fix: move when API call happens so errors can get caught
Browse files Browse the repository at this point in the history
  • Loading branch information
niekcandaele committed Aug 17, 2024
1 parent be01a97 commit e0c3f2b
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions packages/test/src/integrationTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,26 @@ export class IntegrationTest<SetupData> {
}

async function teardown(): Promise<void> {
const failedFunctionsRes = await integrationTestContext.client.event.eventControllerGetFailedFunctions();

if (failedFunctionsRes.data.data.length > 0) {
console.error(`There were ${failedFunctionsRes.data.data.length} failed functions`);
for (const failedFn of failedFunctionsRes.data.data) {
const name = (failedFn.meta as TakaroEventCommandExecuted).command?.name;
const msgs = (failedFn.meta as TakaroEventCommandExecuted)?.result.logs.map((l) => l.msg);
console.log(`Function with name "${name}" failed with messages: ${msgs}`);
}
}

if (integrationTestContext.test.teardown) {
await integrationTestContext.test.teardown.bind(integrationTestContext)();
}

if (integrationTestContext.standardDomainId) {
try {
const failedFunctionsRes = await integrationTestContext.client.event.eventControllerGetFailedFunctions();

if (failedFunctionsRes.data.data.length > 0) {
console.error(`There were ${failedFunctionsRes.data.data.length} failed functions`);
for (const failedFn of failedFunctionsRes.data.data) {
const name = (failedFn.meta as TakaroEventCommandExecuted).command?.name;
const msgs = (failedFn.meta as TakaroEventCommandExecuted)?.result.logs.map((l) => l.msg);
console.log(`Function with name "${name}" failed with messages: ${msgs}`);
}
}
} catch (_error) {
// Ignore, just reporting
}

try {
await integrationTestContext.adminClient.domain.domainControllerRemove(
integrationTestContext.standardDomainId,
Expand Down

0 comments on commit e0c3f2b

Please sign in to comment.