Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

test(api): settle the import mapping before asserting its rejection (#561)

Croffd4550602f396
diff --git a/apps/api/src/modules/imports/__tests__/integration/imports.test.ts b/apps/api/src/modules/imports/__tests__/integration/imports.test.ts
index 2c9d08be..dec611d7 100644
--- a/apps/api/src/modules/imports/__tests__/integration/imports.test.ts
+++ b/apps/api/src/modules/imports/__tests__/integration/imports.test.ts
@@ -127,9 +127,10 @@ describe('imports', () => {
it('refuses a mapping that names a column the file does not have', async () => {
const { asOwner } = await setup();
const uploaded = await uploadWorkbook(asOwner, [['Task'], ['Only']]);
- await expect(mapImport(uploaded.data!.id, { title: 'Nope' })).rejects.toThrow(
- 'not in the file',
- );
+ // Settled before the assertion: Bun's `rejects` on a pending promise waits in a
+ // nested event loop, where reading the workbook takes seconds and trips the timeout.
+ const error = await mapImport(uploaded.data!.id, { title: 'Nope' }).catch((e: unknown) => e);
+ expect((error as Error).message).toContain('not in the file');
});
it('refuses to map a file that does not parse into a table', async () => {