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:
@@ -190,6 +190,7 @@ describe('DetailComponent', () => {
|
||||
spyOn(navigator.clipboard, 'writeText').and.returnValue(Promise.reject(new Error('denied')));
|
||||
component.copyUrl();
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
expect(toast.show).toHaveBeenCalledWith('Failed to copy URL', 'error');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user