2017-05-07 09:49:15 +02:00
|
|
|
import asyncConfig from './asyncConfig';
|
|
|
|
import fields from './fields';
|
|
|
|
|
|
|
|
jest.mock('./fields');
|
|
|
|
|
2018-05-24 09:02:44 +02:00
|
|
|
fields.mockImplementation(() => [
|
|
|
|
Promise.resolve({
|
|
|
|
someField: 'newValue',
|
|
|
|
}),
|
|
|
|
]);
|
2017-05-07 09:49:15 +02:00
|
|
|
|
2018-05-25 07:24:09 +02:00
|
|
|
test('it should merge the result of the promise', async () => {
|
2017-05-07 09:49:15 +02:00
|
|
|
const param = { another: 'field', someField: 'oldValue' };
|
|
|
|
const expected = { another: 'field', someField: 'newValue' };
|
|
|
|
|
2018-05-25 07:24:09 +02:00
|
|
|
const result = await asyncConfig(param);
|
|
|
|
expect(result).toEqual(expected);
|
2017-05-07 09:49:15 +02:00
|
|
|
});
|