Skip to content

Commit de2fc6b

Browse files
committed
Take out the dependency on getNewId() in the settings dialog test
The returned id from this method is increasing on every call, making snapshot testing with code using it flaky. Signed-off-by: Mike Lischke <mike@lischke-online.de>
1 parent 943ab1e commit de2fc6b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/ui/SettingsDialog.spec.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
88

99
import type { IUISettings } from "../../src/core/AppStorage.js";
1010
import { AppStorage } from "../../src/core/AppStorage.js";
11+
import * as utils from "../../src/core/utils.js";
1112
import { requisitions } from "../../src/supplement/Requisitions.js";
1213
import { SettingsDialog } from "../../src/ui/SettingsDialog.js";
1314

@@ -51,6 +52,8 @@ describe.sequential("SettingsDialog (class)", () => {
5152

5253
beforeEach(() => {
5354
vi.restoreAllMocks();
55+
let nextId = 3;
56+
vi.spyOn(utils, "getNewId").mockImplementation(() => nextId++);
5457
renderResult = null;
5558
});
5659

0 commit comments

Comments
 (0)