2017-05-07 07:49:15 +00:00
|
|
|
import optionsMain from './optionsMain';
|
|
|
|
import asyncConfig from './asyncConfig';
|
|
|
|
|
|
|
|
jest.mock('./asyncConfig');
|
|
|
|
const mockedAsyncConfig = { some: 'options' };
|
|
|
|
asyncConfig.mockImplementation(() => Promise.resolve(mockedAsyncConfig));
|
|
|
|
|
2018-05-25 05:24:09 +00:00
|
|
|
test('it should call the async config', async () => {
|
2017-05-07 07:49:15 +00:00
|
|
|
const params = {
|
|
|
|
targetUrl: 'http://example.com',
|
|
|
|
};
|
2018-05-25 05:24:09 +00:00
|
|
|
const result = await optionsMain(params);
|
|
|
|
expect(asyncConfig).toHaveBeenCalledWith(expect.objectContaining(params));
|
|
|
|
expect(result).toEqual(mockedAsyncConfig);
|
2017-05-07 07:49:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// TODO add more tests
|