Skip to content

Commit

Permalink
fix(server): debug log responses
Browse files Browse the repository at this point in the history
  • Loading branch information
jrea committed Oct 9, 2024
1 parent e7fed25 commit aca76ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/server/src/utils/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ export async function _fetch(
if (response && response.status >= 200 && response.status < 300) {
if (typeof response.clone === 'function') {
try {
info(`[fetch][response] ${await response.clone().json()}`);
info(
`[fetch][response] ${JSON.stringify(await response.clone().json())}`
);
} catch (e) {
info(`[fetch][response] ${await response.clone().text()}`, { e });
}
Expand Down
13 changes: 10 additions & 3 deletions packages/server/test/integration/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,18 @@ describe.skip('api integration', () => {
email: String(process.env.EMAIL),
password: String(process.env.PASSWORD),
});
nile.tenantId = tenantId;
const tenants = await nile.api.tenants.listTenants();

if (Array.isArray(tenants)) {
nile.tenantId = tenants[0].id;
}

const tenantUsers = await nile.api.users.listUsers();
const users = await nile.api.users.listUsers();
expect(users).toEqual(tenantUsers);
if (Array.isArray(users)) {
expect(users.length).toEqual(1);
} else {
throw Error('no users');
}
});
});

Expand Down

0 comments on commit aca76ac

Please sign in to comment.