Skip to content

Commit

Permalink
fix more test usages 3
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Apr 19, 2023
1 parent 235188e commit ff14b8e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions x-pack/plugins/rollup/server/collectors/register.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ import { registerRollupUsageCollector } from './register';

describe('registerRollupUsageCollector', () => {
const mockIndex = 'mock_index';
const getIndexForType = () => Promise.resolve(mockIndex);

it('makes a usage collector and registers it`', () => {
const mockCollectorSet = createUsageCollectionSetupMock();
registerRollupUsageCollector(mockCollectorSet, mockIndex);
registerRollupUsageCollector(mockCollectorSet, getIndexForType);
expect(mockCollectorSet.makeUsageCollector).toBeCalledTimes(1);
expect(mockCollectorSet.registerCollector).toBeCalledTimes(1);
});

it('makeUsageCollector configs fit the shape', () => {
const mockCollectorSet = createUsageCollectionSetupMock();
registerRollupUsageCollector(mockCollectorSet, mockIndex);
registerRollupUsageCollector(mockCollectorSet, getIndexForType);
expect(mockCollectorSet.makeUsageCollector).toHaveBeenCalledWith({
type: 'rollups',
isReady: expect.any(Function),
Expand Down Expand Up @@ -81,7 +82,7 @@ describe('registerRollupUsageCollector', () => {

it('makeUsageCollector config.isReady returns true', () => {
const mockCollectorSet = createUsageCollectionSetupMock();
registerRollupUsageCollector(mockCollectorSet, mockIndex);
registerRollupUsageCollector(mockCollectorSet, getIndexForType);
const usageCollectorConfig = mockCollectorSet.makeUsageCollector.mock.calls[0][0];
expect(usageCollectorConfig.isReady()).toBe(true);
});
Expand Down

0 comments on commit ff14b8e

Please sign in to comment.