Skip to content

Commit

Permalink
Fix types in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
afharo committed Feb 26, 2020
1 parent 061899b commit 56906b0
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('telemetry_application_usage', () => {
} as any;

const getUsageCollector = jest.fn();
const callCluster = jest.fn();

beforeAll(() => registerApplicationUsageCollector(usageCollectionMock, getUsageCollector));
afterAll(() => jest.clearAllTimers());
Expand All @@ -48,7 +49,7 @@ describe('telemetry_application_usage', () => {
});

test('if no savedObjectClient initialised, return undefined', async () => {
expect(await collector.fetch({})).toBeUndefined();
expect(await collector.fetch(callCluster)).toBeUndefined();
jest.runTimersToTime(ROLL_INDICES_INTERVAL);
});

Expand All @@ -63,7 +64,7 @@ describe('telemetry_application_usage', () => {
);
getUsageCollector.mockImplementation(() => savedObjectClient);

expect(await collector.fetch({})).toStrictEqual({});
expect(await collector.fetch(callCluster)).toStrictEqual({});
jest.runTimersToTime(ROLL_INDICES_INTERVAL);
});

Expand All @@ -86,7 +87,7 @@ describe('telemetry_application_usage', () => {
total: 1,
} as any;
}
if (opts.page > 2) {
if ((opts.page || 1) > 2) {
return { saved_objects: [], total };
}
const doc = {
Expand All @@ -104,7 +105,7 @@ describe('telemetry_application_usage', () => {
});
getUsageCollector.mockImplementation(() => savedObjectClient);

expect(await collector.fetch({})).toStrictEqual({
expect(await collector.fetch(callCluster)).toStrictEqual({
appId: {
clicks_total: total - 1 + 10,
clicks_30_days: total - 1,
Expand Down

0 comments on commit 56906b0

Please sign in to comment.