Skip to content

Commit

Permalink
fix mocked reference
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Mar 4, 2020
1 parent 667194f commit ede5c03
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

jest.mock('../../export', () => ({
getSortedObjectsForExport: jest.fn(),
exportSavedObjectsToStream: jest.fn(),
}));

import * as exportMock from '../../export';
Expand All @@ -30,7 +30,7 @@ import { registerExportRoute } from '../export';
import { setupServer } from './test_utils';

type setupServerReturn = UnwrapPromise<ReturnType<typeof setupServer>>;
const getSortedObjectsForExport = exportMock.exportSavedObjectsToStream as jest.Mock;
const exportSavedObjectsToStream = exportMock.exportSavedObjectsToStream as jest.Mock;
const allowedTypes = ['index-pattern', 'search'];
const config = {
maxImportPayloadBytes: 10485760,
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('POST /api/saved_objects/_export', () => {
],
},
];
getSortedObjectsForExport.mockResolvedValueOnce(createListStream(sortedObjects));
exportSavedObjectsToStream.mockResolvedValueOnce(createListStream(sortedObjects));

const result = await supertest(httpSetup.server.listener)
.post('/api/saved_objects/_export')
Expand All @@ -96,7 +96,7 @@ describe('POST /api/saved_objects/_export', () => {

const objects = (result.text as string).split('\n').map(row => JSON.parse(row));
expect(objects).toEqual(sortedObjects);
expect(getSortedObjectsForExport.mock.calls[0][0]).toEqual(
expect(exportSavedObjectsToStream.mock.calls[0][0]).toEqual(
expect.objectContaining({
excludeExportDetails: false,
exportSizeLimit: 10000,
Expand Down

0 comments on commit ede5c03

Please sign in to comment.