Nativefier/src/options/optionsMain.test.ts

26 lines
685 B
TypeScript

import { getOptions } from './optionsMain';
import * as asyncConfig from './asyncConfig';
const mockedAsyncConfig = { some: 'options' };
let asyncConfigMock: jasmine.Spy;
beforeAll(() => {
asyncConfigMock = spyOn(asyncConfig, 'asyncConfig').and.returnValue(
mockedAsyncConfig,
);
});
test('it should call the async config', async () => {
const params = {
targetUrl: 'https://example.com/',
};
const result = await getOptions(params);
expect(asyncConfigMock).toHaveBeenCalledWith(
expect.objectContaining({
packager: expect.anything(),
nativefier: expect.anything(),
}),
);
expect(result.packager.targetUrl).toEqual(params.targetUrl);
});