main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
565 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | describe("AbortController in browser", function () {
|
---|
| 2 | // Mock AbortController
|
---|
| 3 | const mockedGlobalAbortController = jest.fn();
|
---|
| 4 |
|
---|
| 5 | beforeAll(() => {
|
---|
| 6 | // Attach mocked AbortController to global
|
---|
| 7 | self.AbortController = mockedGlobalAbortController;
|
---|
| 8 | });
|
---|
| 9 |
|
---|
| 10 | it("should call global abort controller", function () {
|
---|
| 11 | // Require module after global setup
|
---|
| 12 | const { AbortController } = require("../browser.js");
|
---|
| 13 |
|
---|
| 14 | const controller = new AbortController();
|
---|
| 15 |
|
---|
| 16 | expect(controller).toBeTruthy();
|
---|
| 17 | expect(mockedGlobalAbortController).toBeCalled();
|
---|
| 18 | });
|
---|
| 19 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.