Skip to content

Commit

Permalink
remove race condition from abortable fetch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wheresrhys committed Jun 18, 2024
1 parent aba4e0b commit 7d04bde
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions test/specs/abortable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,8 @@ describe('abortable fetch', () => {
let fm;

const expectAbortError = async (...fetchArgs) => {
try {
await fm.fetchHandler(...fetchArgs);
throw new Error('unexpected');
} catch (error) {
expect(error instanceof DOMException).toEqual(true);
expect(error.name).toEqual('AbortError');
expect(error.message).toEqual('The operation was aborted.');
}
const result = fm.fetchHandler(...fetchArgs);
await expect(result).rejects.toThrowError(new DOMException('The operation was aborted.', 'ABortError'));
};

beforeEach(() => {
Expand Down

0 comments on commit 7d04bde

Please sign in to comment.