Skip to content

Commit 1715116

Browse files
committed
test: reset transaction mock implementations between repair-commands tests
vi.clearAllMocks() wipes call history but keeps implementations set via mockImplementation, so the storage transaction mocks overridden inline by individual tests bled into later tests. Reset all three in beforeEach; their factory defaults are bare vi.fn(), so mockReset restores the exact initial state. https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
1 parent 9beb20e commit 1715116

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test/repair-commands.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ function createDeps(
158158
describe("repair-commands direct deps coverage", () => {
159159
beforeEach(() => {
160160
vi.clearAllMocks();
161+
// clearAllMocks wipes call history but keeps mockImplementation, so the
162+
// transaction mocks set inline by individual tests must be reset here or
163+
// they bleed into later tests that rely on the default behavior.
164+
storageMocks.withAccountStorageTransaction.mockReset();
165+
storageMocks.withFlaggedStorageTransaction.mockReset();
166+
storageMocks.withAccountAndFlaggedStorageTransaction.mockReset();
161167
existsSyncMock.mockReturnValue(false);
162168
quotaCacheMocks.loadQuotaCache.mockResolvedValue(null);
163169
codexCliStateMocks.loadCodexCliState.mockResolvedValue(null);

0 commit comments

Comments
 (0)