Skip to content

Commit

Permalink
🔧 improve unit test stability while using uuid (#3144)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis authored Jul 27, 2024
1 parent 73d52fa commit 0eb62a0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/loot-core/src/mocks/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ jest.mock('uuid', () => ({
return 'id' + _id++;
},
}));
jest.mock('../server/migrate/migrations', () => {
const realMigrations = jest.requireActual('../server/migrate/migrations');
return {
...realMigrations,
migrate: async db => {
_id = 100_000_000;
await realMigrations.migrate(db);
_id = 1;
},
};
});

global.getDatabaseDump = async function (tables) {
if (!tables) {
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3144.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [MatissJanis]
---

Unit tests: improve the reliability of unique ids.

0 comments on commit 0eb62a0

Please sign in to comment.