Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(admin): wait for the migration POST instead of reading it after the toast

Maurice72935d7e40b7
diff --git a/client/tests/unit/mobile/admin/MAdminStoragePanel.test.tsx b/client/tests/unit/mobile/admin/MAdminStoragePanel.test.tsx
index bc2b05dcb..6da31e47e 100644
--- a/client/tests/unit/mobile/admin/MAdminStoragePanel.test.tsx
+++ b/client/tests/unit/mobile/admin/MAdminStoragePanel.test.tsx
@@ -271,7 +271,12 @@ describe('MAdminStoragePanel', () => {
await screen.findByText('Storage configuration saved');
// files is default-sourced (uploads-local) in baseState() — stripping restores "no override".
expect((putBody as StorageConfig).categories.files).toBeUndefined();
- expect(migrationBody).toEqual({ category: 'files', to: 'off-box' });
+ // Waited for, not read straight after the toast. The toast comes from the
+ // PUT, while the migration POST is fired by the queue effect one commit
+ // later, so the two are not the same tick. Reading it immediately only held
+ // while that effect happened to flush first, which under CI load it does
+ // not. Same fix as FE-ADMIN-STOR-030 on the desktop twin.
+ await waitFor(() => expect(migrationBody).toEqual({ category: 'files', to: 'off-box' }));
expect(screen.queryByRole('alertdialog')).not.toBeInTheDocument();
});