Skip to content

Commit

Permalink
add exporter test
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Sep 1, 2021
1 parent 1e8f092 commit 461c7b7
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1316,5 +1316,43 @@ describe('getSortedObjectsForExport()', () => {
}
`);
});

test(`uses the object's spaces when calling 'bulkGet' if present`, async () => {
savedObjectsClient.bulkGet.mockResolvedValueOnce({
saved_objects: [],
});
await exporter.exportByObjects({
request,
objects: [
{
type: 'index-pattern',
id: '1',
namespace: 'ns-1',
},
{
type: 'search',
id: '2',
namespace: 'ns-2',
},
],
});

expect(savedObjectsClient.bulkGet).toHaveBeenCalledTimes(1);
expect(savedObjectsClient.bulkGet).toHaveBeenCalledWith(
[
{
type: 'index-pattern',
id: '1',
namespaces: ['ns-1'],
},
{
type: 'search',
id: '2',
namespaces: ['ns-2'],
},
],
{}
);
});
});
});

0 comments on commit 461c7b7

Please sign in to comment.