Skip to content

Commit

Permalink
Remove AbortController test mock (#3506)
Browse files Browse the repository at this point in the history
This library includes an `AbortController` test mock, which doesn't work
in places that expect a real one. For example, I was writing an
unrelated test that tried to cancel a `fetch()` which failed because
the `AbortController`'s `signal` property was invalid.

Because [`AbortController` is in all supported Node versions][0], we can
safely remove this mock and rely on the real thing.

This should only affect tests.

[0]: https://developer.mozilla.org/en-US/docs/Web/API/AbortController#browser_compatibility
  • Loading branch information
EvanHahn authored Jun 5, 2024
1 parent 7806111 commit 5b6489e
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions setup-jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,3 @@ NativeModules.RNMBXChangeLineOffsetsShapeAnimatorModule = {
NativeModules.RNMBXLogging = nativeModule({
setLogLevel: jest.fn(),
});

// Mock for global AbortController
global.AbortController = class {
signal = 'test-signal';
abort = jest.fn();
};

0 comments on commit 5b6489e

Please sign in to comment.