Fix: Await second microtask tick in copyUrl reject test

The .catch() handler on a rejected promise resolves on the second
microtask tick, not the first — one extra await Promise.resolve() is
needed before the assertion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 22:31:58 +00:00
parent 7d49c12ce2
commit b094389131

View File

@@ -190,6 +190,7 @@ describe('DetailComponent', () => {
spyOn(navigator.clipboard, 'writeText').and.returnValue(Promise.reject(new Error('denied'))); spyOn(navigator.clipboard, 'writeText').and.returnValue(Promise.reject(new Error('denied')));
component.copyUrl(); component.copyUrl();
await Promise.resolve(); await Promise.resolve();
await Promise.resolve();
expect(toast.show).toHaveBeenCalledWith('Failed to copy URL', 'error'); expect(toast.show).toHaveBeenCalledWith('Failed to copy URL', 'error');
}); });
}); });