|
7 | 7 |
|
8 | 8 | import { httpServiceMock } from '@kbn/core/public/mocks';
|
9 | 9 | import { createClientAPI } from '.';
|
10 |
| -import { allCases, allCasesSnake } from '../../containers/mock'; |
| 10 | +import { allCases, allCasesSnake, casesSnake } from '../../containers/mock'; |
11 | 11 |
|
12 | 12 | describe('createClientAPI', () => {
|
13 | 13 | beforeEach(() => {
|
@@ -84,11 +84,19 @@ describe('createClientAPI', () => {
|
84 | 84 | describe('bulkGet', () => {
|
85 | 85 | const http = httpServiceMock.createStartContract({ basePath: '' });
|
86 | 86 | const api = createClientAPI({ http });
|
87 |
| - http.post.mockResolvedValue({ cases: [], errors: [] }); |
| 87 | + http.post.mockResolvedValue({ cases: [{ title: 'test' }], errors: [] }); |
88 | 88 |
|
89 |
| - it('should return the correct response', async () => { |
| 89 | + it('should return the correct cases with a subset of fields', async () => { |
| 90 | + expect(await api.cases.bulkGet({ ids: ['test'], fields: ['title'] })).toEqual({ |
| 91 | + cases: [{ title: 'test' }], |
| 92 | + errors: [], |
| 93 | + }); |
| 94 | + }); |
| 95 | + |
| 96 | + it('should return the correct cases with all fields', async () => { |
| 97 | + http.post.mockResolvedValueOnce({ cases: casesSnake, errors: [] }); |
90 | 98 | expect(await api.cases.bulkGet({ ids: ['test'], fields: ['title'] })).toEqual({
|
91 |
| - cases: [], |
| 99 | + cases: casesSnake, |
92 | 100 | errors: [],
|
93 | 101 | });
|
94 | 102 | });
|
|
0 commit comments