29 lines
975 B
TypeScript
29 lines
975 B
TypeScript
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
|
|
|
|
import databaseRefreshHandler from '~background/messages/database/refresh';
|
|
import updateAvailableHandler from '~background/messages/extension/updateAvailable';
|
|
import onStartup from '~background/utils/runtime/onStartup';
|
|
|
|
jest.mock('~background/messages/database/refresh');
|
|
jest.mock('~background/messages/extension/updateAvailable');
|
|
|
|
describe('background/utils/runtime/onStartup.ts', () => {
|
|
beforeEach(() => {
|
|
jest.clearAllMocks();
|
|
});
|
|
|
|
it('should execute calls in sequence', async () => {
|
|
await onStartup();
|
|
|
|
expect(chrome.storage.local.remove).toHaveBeenCalledWith('updateAvailable');
|
|
expect(databaseRefreshHandler).toHaveBeenCalledWith(
|
|
{ name: 'database/refresh' },
|
|
{ send: expect.any(Function) }
|
|
);
|
|
expect(updateAvailableHandler).toHaveBeenCalledWith(
|
|
{ name: 'extension/updateAvailable' },
|
|
{ send: expect.any(Function) }
|
|
);
|
|
});
|
|
});
|