Skip to content

Commit bcae93c

Browse files
committed
fixed faling typechecks
1 parent 410a1d3 commit bcae93c

File tree

7 files changed

+32
-32
lines changed

7 files changed

+32
-32
lines changed

x-pack/plugins/event_log/server/es/cluster_client_adapter.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,10 @@ describe('queryEventsBySavedObject', () => {
365365
},
366366
},
367367
Object {
368-
"term": Object {
369-
"kibana.saved_objects.id": Object {
370-
"value": "saved-object-id",
371-
},
368+
"terms": Object {
369+
"kibana.saved_objects.id": Array [
370+
"saved-object-id",
371+
],
372372
},
373373
},
374374
Object {
@@ -444,10 +444,10 @@ describe('queryEventsBySavedObject', () => {
444444
},
445445
},
446446
Object {
447-
"term": Object {
448-
"kibana.saved_objects.id": Object {
449-
"value": "saved-object-id",
450-
},
447+
"terms": Object {
448+
"kibana.saved_objects.id": Array [
449+
"saved-object-id",
450+
],
451451
},
452452
},
453453
Object {
@@ -553,10 +553,10 @@ describe('queryEventsBySavedObject', () => {
553553
},
554554
},
555555
Object {
556-
"term": Object {
557-
"kibana.saved_objects.id": Object {
558-
"value": "saved-object-id",
559-
},
556+
"terms": Object {
557+
"kibana.saved_objects.id": Array [
558+
"saved-object-id",
559+
],
560560
},
561561
},
562562
Object {
@@ -643,10 +643,10 @@ describe('queryEventsBySavedObject', () => {
643643
},
644644
},
645645
Object {
646-
"term": Object {
647-
"kibana.saved_objects.id": Object {
648-
"value": "saved-object-id",
649-
},
646+
"terms": Object {
647+
"kibana.saved_objects.id": Array [
648+
"saved-object-id",
649+
],
650650
},
651651
},
652652
Object {

x-pack/plugins/event_log/server/event_log_client.mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { IEventLogClient } from './types';
88

99
const createEventLogClientMock = () => {
1010
const mock: jest.Mocked<IEventLogClient> = {
11-
findEventsBySavedObject: jest.fn(),
11+
findEventsBySavedObjectIds: jest.fn(),
1212
};
1313
return mock;
1414
};

x-pack/plugins/event_log/server/event_log_client.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe('EventLogStart', () => {
3131

3232
await eventLogClient.findEventsBySavedObjectIds('saved-object-type', ['saved-object-id']);
3333

34-
expect(savedObjectGetter).toHaveBeenCalledWith('saved-object-type', 'saved-object-id');
34+
expect(savedObjectGetter).toHaveBeenCalledWith('saved-object-type', ['saved-object-id']);
3535
});
3636

3737
test('throws when the user doesnt have permission to access the specified saved object', async () => {
@@ -117,7 +117,7 @@ describe('EventLogStart', () => {
117117
esContext.esNames.indexPattern,
118118
undefined,
119119
'saved-object-type',
120-
'saved-object-id',
120+
['saved-object-id'],
121121
{
122122
page: 1,
123123
per_page: 10,
@@ -198,7 +198,7 @@ describe('EventLogStart', () => {
198198
esContext.esNames.indexPattern,
199199
undefined,
200200
'saved-object-type',
201-
'saved-object-id',
201+
['saved-object-id'],
202202
{
203203
page: 1,
204204
per_page: 10,

x-pack/plugins/event_log/server/routes/find.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('find', () => {
3939
const [context, req, res] = mockHandlerArguments(
4040
eventLogClient,
4141
{
42-
params: { ids: ['1'], type: 'action' },
42+
params: { id: '1', type: 'action' },
4343
},
4444
['ok']
4545
);
@@ -50,7 +50,7 @@ describe('find', () => {
5050

5151
const [type, ids] = eventLogClient.findEventsBySavedObjectIds.mock.calls[0];
5252
expect(type).toEqual(`action`);
53-
expect(ids).toEqual(`[1]`);
53+
expect(ids).toEqual(['1']);
5454

5555
expect(res.ok).toHaveBeenCalledWith({
5656
body: result,
@@ -73,7 +73,7 @@ describe('find', () => {
7373
const [context, req, res] = mockHandlerArguments(
7474
eventLogClient,
7575
{
76-
params: { ids: ['1'], type: 'action' },
76+
params: { id: '1', type: 'action' },
7777
query: { page: 3, per_page: 10 },
7878
},
7979
['ok']
@@ -83,9 +83,9 @@ describe('find', () => {
8383

8484
expect(eventLogClient.findEventsBySavedObjectIds).toHaveBeenCalledTimes(1);
8585

86-
const [type, id, options] = eventLogClient.findEventsBySavedObjectIds.mock.calls[0];
86+
const [type, ids, options] = eventLogClient.findEventsBySavedObjectIds.mock.calls[0];
8787
expect(type).toEqual(`action`);
88-
expect(id).toEqual(`1`);
88+
expect(ids).toEqual(['1']);
8989
expect(options).toMatchObject({});
9090

9191
expect(res.ok).toHaveBeenCalledWith({
@@ -109,7 +109,7 @@ describe('find', () => {
109109
const [context, req, res] = mockHandlerArguments(
110110
eventLogClient,
111111
{
112-
params: { ids: ['1'], type: 'action' },
112+
params: { id: '1', type: 'action' },
113113
query: { page: 3, per_page: 10 },
114114
},
115115
['ok']

x-pack/plugins/event_log/server/routes/find_by_ids.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('find_by_ids', () => {
5151

5252
const [type, ids] = eventLogClient.findEventsBySavedObjectIds.mock.calls[0];
5353
expect(type).toEqual(`action`);
54-
expect(ids).toEqual(`1`);
54+
expect(ids).toEqual(['1']);
5555

5656
expect(res.ok).toHaveBeenCalledWith({
5757
body: result,
@@ -87,7 +87,7 @@ describe('find_by_ids', () => {
8787

8888
const [type, id, options] = eventLogClient.findEventsBySavedObjectIds.mock.calls[0];
8989
expect(type).toEqual(`action`);
90-
expect(id).toEqual(`1`);
90+
expect(id).toEqual(['1']);
9191
expect(options).toMatchObject({});
9292

9393
expect(res.ok).toHaveBeenCalledWith({
@@ -105,7 +105,7 @@ describe('find_by_ids', () => {
105105

106106
findByIdsRoute(router, systemLogger);
107107

108-
const [, handler] = router.get.mock.calls[0];
108+
const [, handler] = router.post.mock.calls[0];
109109
eventLogClient.findEventsBySavedObjectIds.mockRejectedValueOnce(new Error('oof!'));
110110

111111
const [context, req, res] = mockHandlerArguments(

x-pack/plugins/event_log/server/routes/find_by_ids.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const findByIdsRoute = (router: IRouter, systemLogger: Logger) => {
5555
body: await eventLogClient.findEventsBySavedObjectIds(type, ids, query),
5656
});
5757
} catch (err) {
58-
const call = `findEventsBySavedObject(${type}, [${ids}], ${JSON.stringify(query)})`;
58+
const call = `findEventsBySavedObjectIds(${type}, [${ids}], ${JSON.stringify(query)})`;
5959
systemLogger.debug(`error calling eventLog ${call}: ${err.message}`);
6060
return res.notFound();
6161
}

x-pack/plugins/event_log/server/saved_object_provider_registry.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('SavedObjectProviderRegistry', () => {
4848
expect(await registry.getProvidersClient(request)('alert', [alert.id])).toMatchObject(alert);
4949

5050
expect(provider).toHaveBeenCalledWith(request);
51-
expect(getter).toHaveBeenCalledWith('alert', alert.id);
51+
expect(getter).toHaveBeenCalledWith([{ id: alert.id, type: 'alert' }]);
5252
});
5353

5454
test('should get SavedObject using the default provider for unregistered types', async () => {
@@ -74,7 +74,7 @@ describe('SavedObjectProviderRegistry', () => {
7474
action
7575
);
7676

77-
expect(getter).toHaveBeenCalledWith('action', action.id);
77+
expect(getter).toHaveBeenCalledWith([{ id: action.id, type: 'action' }]);
7878
expect(defaultProvider).toHaveBeenCalledWith(request);
7979
});
8080
});

0 commit comments

Comments
 (0)