Skip to content

Commit 5565c98

Browse files
committed
fixed some more missed anys
1 parent 8a7e27c commit 5565c98

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

x-pack/plugins/actions/server/builtin_action_types/slack.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,12 @@ describe('execute()', () => {
155155
params: { message: 'this invocation should succeed' },
156156
});
157157
expect(response).toMatchInlineSnapshot(`
158-
Object {
159-
"text": "slack mockExecutor success: this invocation should succeed",
160-
}
161-
`);
158+
Object {
159+
"actionId": "",
160+
"status": "ok",
161+
"text": "slack mockExecutor success: this invocation should succeed",
162+
}
163+
`);
162164
});
163165

164166
test('calls the mock executor with failure', async () => {

x-pack/plugins/alerting/server/alerts_client.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
import uuid from 'uuid';
77
import { schema } from '@kbn/config-schema';
8-
import { AlertsClient } from './alerts_client';
8+
import { AlertsClient, CreateOptions } from './alerts_client';
99
import { savedObjectsClientMock, loggingServiceMock } from '../../../../src/core/server/mocks';
1010
import { taskManagerMock } from '../../../plugins/task_manager/server/task_manager.mock';
1111
import { alertTypeRegistryMock } from './alert_type_registry.mock';
@@ -45,6 +45,7 @@ beforeEach(() => {
4545
});
4646

4747
const mockedDate = new Date('2019-02-12T21:01:22.479Z');
48+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4849
(global as any).Date = class Date {
4950
constructor() {
5051
return mockedDate;
@@ -54,7 +55,7 @@ const mockedDate = new Date('2019-02-12T21:01:22.479Z');
5455
}
5556
};
5657

57-
function getMockData(overwrites: Record<string, any> = {}) {
58+
function getMockData(overwrites: Record<string, unknown> = {}): CreateOptions['data'] {
5859
return {
5960
enabled: true,
6061
name: 'abc',

x-pack/plugins/alerting/server/alerts_client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export interface FindResult {
8484
data: SanitizedAlert[];
8585
}
8686

87-
interface CreateOptions {
87+
export interface CreateOptions {
8888
data: Omit<
8989
Alert,
9090
| 'id'

x-pack/plugins/alerting/server/alerts_client_factory.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ test('createAPIKey() returns an API key when security is enabled', async () => {
133133
const createAPIKeyResult = await constructorCall.createAPIKey();
134134
expect(createAPIKeyResult).toEqual({
135135
apiKeysEnabled: true,
136-
result: { api_key: '123', id: 'abc' },
136+
result: { api_key: '123', id: 'abc', name: '' },
137137
});
138138
});
139139

x-pack/plugins/alerting/server/task_runner/get_next_run_at.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { getNextRunAt } from './get_next_run_at';
88

99
const mockedNow = new Date('2019-06-03T18:55:25.982Z');
10+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1011
(global as any).Date = class Date extends global.Date {
1112
static now() {
1213
return mockedNow.getTime();

x-pack/plugins/task_manager/server/task_runner.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -854,8 +854,8 @@ describe('TaskManagerRunner', () => {
854854

855855
interface TestOpts {
856856
instance?: Partial<ConcreteTaskInstance>;
857-
definitions?: any;
858-
onTaskEvent?: (event: TaskEvent<any, any>) => void;
857+
definitions?: unknown;
858+
onTaskEvent?: (event: TaskEvent<unknown, unknown>) => void;
859859
}
860860

861861
function testOpts(opts: TestOpts) {
@@ -904,7 +904,7 @@ describe('TaskManagerRunner', () => {
904904
title: 'Bar!',
905905
createTaskRunner,
906906
},
907-
}),
907+
}) as TaskDictionary<TaskDefinition>,
908908
onTaskEvent: opts.onTaskEvent,
909909
});
910910

@@ -918,7 +918,7 @@ describe('TaskManagerRunner', () => {
918918
};
919919
}
920920

921-
async function testReturn(result: any, shouldBeValid: boolean) {
921+
async function testReturn(result: unknown, shouldBeValid: boolean) {
922922
const { runner, logger } = testOpts({
923923
definitions: {
924924
bar: {
@@ -939,11 +939,11 @@ describe('TaskManagerRunner', () => {
939939
}
940940
}
941941

942-
function allowsReturnType(result: any) {
942+
function allowsReturnType(result: unknown) {
943943
return testReturn(result, true);
944944
}
945945

946-
function disallowsReturnType(result: any) {
946+
function disallowsReturnType(result: unknown) {
947947
return testReturn(result, false);
948948
}
949949
});

0 commit comments

Comments
 (0)