Fix linting errors after #13392
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -37,16 +37,16 @@ describe('LocalTaskWorker', () => {
|
||||
);
|
||||
|
||||
// TODO(freben): Rewrite to fake timers - tried, but it wouldn't work
|
||||
expect(fn).toBeCalledTimes(0);
|
||||
expect(fn).toHaveBeenCalledTimes(0);
|
||||
await new Promise(r => setTimeout(r, 100));
|
||||
expect(fn).toBeCalledTimes(0);
|
||||
expect(fn).toHaveBeenCalledTimes(0);
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
expect(fn).toBeCalledTimes(1);
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
expect(fn).toBeCalledTimes(2);
|
||||
expect(fn).toHaveBeenCalledTimes(2);
|
||||
controller.abort();
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
expect(fn).toBeCalledTimes(2);
|
||||
expect(fn).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('runs the happy path (with a cron expression) and handles cancellation', async () => {
|
||||
@@ -69,16 +69,16 @@ describe('LocalTaskWorker', () => {
|
||||
);
|
||||
|
||||
// TODO(freben): Rewrite to fake timers - tried, but it wouldn't work
|
||||
expect(fn).toBeCalledTimes(0);
|
||||
expect(fn).toHaveBeenCalledTimes(0);
|
||||
await new Promise(r => setTimeout(r, 100));
|
||||
expect(fn).toBeCalledTimes(0);
|
||||
expect(fn).toHaveBeenCalledTimes(0);
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
expect(fn).toBeCalledTimes(1);
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
expect(fn).toBeCalledTimes(2);
|
||||
expect(fn).toHaveBeenCalledTimes(2);
|
||||
controller.abort();
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
expect(fn).toBeCalledTimes(2);
|
||||
expect(fn).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('can trigger to abort wait', async () => {
|
||||
@@ -93,13 +93,13 @@ describe('LocalTaskWorker', () => {
|
||||
});
|
||||
|
||||
// TODO(freben): Rewrite to fake timers - tried, but it wouldn't work
|
||||
expect(fn).toBeCalledTimes(0);
|
||||
expect(fn).toHaveBeenCalledTimes(0);
|
||||
await new Promise(r => setTimeout(r, 100));
|
||||
expect(fn).toBeCalledTimes(0);
|
||||
expect(fn).toHaveBeenCalledTimes(0);
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
expect(fn).toBeCalledTimes(1);
|
||||
expect(fn).toHaveBeenCalledTimes(1);
|
||||
worker.trigger();
|
||||
await new Promise(r => setTimeout(r, 10));
|
||||
expect(fn).toBeCalledTimes(2);
|
||||
expect(fn).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -53,7 +53,7 @@ describe('TaskScheduler', () => {
|
||||
});
|
||||
|
||||
await waitForExpect(() => {
|
||||
expect(fn).toBeCalled();
|
||||
expect(fn).toHaveBeenCalled();
|
||||
});
|
||||
},
|
||||
60_000,
|
||||
@@ -74,7 +74,7 @@ describe('TaskScheduler', () => {
|
||||
});
|
||||
|
||||
await waitForExpect(() => {
|
||||
expect(fn).toBeCalled();
|
||||
expect(fn).toHaveBeenCalled();
|
||||
});
|
||||
},
|
||||
60_000,
|
||||
|
||||
@@ -138,7 +138,7 @@ describe('TaskWorker', () => {
|
||||
worker.start(settings);
|
||||
|
||||
await waitForExpect(() => {
|
||||
expect(logger.error).toBeCalled();
|
||||
expect(logger.error).toHaveBeenCalled();
|
||||
});
|
||||
},
|
||||
60_000,
|
||||
@@ -162,7 +162,7 @@ describe('TaskWorker', () => {
|
||||
worker.start(settings);
|
||||
|
||||
await waitForExpect(() => {
|
||||
expect(fn).toBeCalledTimes(3);
|
||||
expect(fn).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
},
|
||||
60_000,
|
||||
@@ -309,9 +309,9 @@ describe('TaskWorker', () => {
|
||||
);
|
||||
await worker1.start(settings, { signal: abortFirst.signal });
|
||||
|
||||
expect(fn1).toBeCalledTimes(0);
|
||||
expect(fn1).toHaveBeenCalledTimes(0);
|
||||
await new Promise(resolve => setTimeout(resolve, 250));
|
||||
expect(fn1).toBeCalledTimes(0);
|
||||
expect(fn1).toHaveBeenCalledTimes(0);
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
expect(fn1.mock.calls.length).toBeGreaterThan(0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user