Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/void/test/unit/email-cli-domain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ beforeEach(() => {
});

afterEach(() => {
vi.useRealTimers();
vi.restoreAllMocks();
vi.unstubAllGlobals();
});
Expand Down Expand Up @@ -425,7 +426,12 @@ describe('emailDomainAdd', () => {
.mockReturnValueOnce('ghp_ignored')
.mockReturnValue(CFUT_TOKEN);
const deps = addDeps({ readClipboard });
await emailDomainAdd(api, 'prj_1', 'acme.com', undefined, deps);
// Fake time keeps the 40 ms watch window from closing on a slow machine
// before the third read; the token arrives on the second 1 ms poll.
vi.useFakeTimers();
const added = emailDomainAdd(api, 'prj_1', 'acme.com', undefined, deps);
await vi.advanceTimersByTimeAsync(deps.watchTimeoutMs!);
await added;
expect(deps.verifyToken).toHaveBeenCalledTimes(1);
expect(deps.verifyToken).toHaveBeenCalledWith(CFUT_TOKEN);
expect(deps.clearClipboard).toHaveBeenCalledTimes(1);
Expand Down
Loading