Skip to content

Commit

Permalink
fix: remove AbortController test mock (maplibre#403)
Browse files Browse the repository at this point in the history
[This change was recently made in rnmapbox.][0]

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][1], we can
safely remove this mock and rely on the real thing.

This should only affect tests.

[0]: rnmapbox/maps@5b6489e
[1]: https://developer.mozilla.org/en-US/docs/Web/API/AbortController#browser_compatibility
  • Loading branch information
EvanHahn authored Jun 12, 2024
1 parent 07fb7b2 commit 698b558
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ PR Title ([#123](link to my pr))
```

Fix: [android example crashing](https://github.com/maplibre/maplibre-react-native/pull/372) on launch
Fix: [remove AbortController test mock](https://github.com/maplibre/maplibre-react-native/pull/403)

## 10.0.0-alpha.4
Update maplibre-native to use [new metal renderer on iOS](https://github.com/maplibre/maplibre-native/releases/tag/ios-v6.4.0)
Expand Down
6 changes: 0 additions & 6 deletions setup-jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,3 @@ NativeModules.MLNLocationModule = {
stop: jest.fn(),
pause: jest.fn(),
};

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

0 comments on commit 698b558

Please sign in to comment.