Skip to content

Commit

Permalink
Add logs to check tearDown defined
Browse files Browse the repository at this point in the history
  • Loading branch information
ttakenaga committed Jul 9, 2024
1 parent 85f7b0e commit 7a3bbbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion packages/circus-api/src/api/series/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@ let apiTest: ApiTest, ax: typeof apiTest.axiosInstances;
beforeAll(async () => {
apiTest = await setUpAppForRoutesTest();
ax = apiTest.axiosInstances;
console.log('apiTest initialized:', apiTest);
});

afterAll(async () => await apiTest.tearDown());
afterAll(async () => {
if (apiTest && typeof apiTest.tearDown === 'function') {
console.log('Calling tearDown');
await apiTest.tearDown();
console.log('tearDown called successfully');
} else {
console.error('tearDown is not a function or apiTest is undefined');
}
});

it('should perform search', async () => {
const res = await ax.dave.request({
Expand Down
2 changes: 1 addition & 1 deletion packages/circus-api/test/util-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export interface ApiTest {
* Shuts down the test Koa server and the DB connection.
* Make sure to call this on `afterAll()`.
*/
tearDown: () => void;
tearDown: () => Promise<void>;
/**
* The URL of the test Koa endpoint server.
* The members of `axiosInstances` are configured to use this by default.
Expand Down

0 comments on commit 7a3bbbc

Please sign in to comment.