Skip to content

Commit

Permalink
fix more test usages
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Apr 18, 2023
1 parent 4537691 commit 8466aa5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ describe('saved_objects_count_collector', () => {
const fetchContextMock = createCollectorFetchContextMock();

const kibanaIndex = '.kibana-tests';
const getAllIndices = () => Promise.resolve([kibanaIndex]);

beforeAll(() =>
registerSavedObjectsCountUsageCollector(usageCollectionMock, kibanaIndex, () =>
registerSavedObjectsCountUsageCollector(usageCollectionMock, getAllIndices, () =>
Promise.resolve(['type_one', 'type_two', 'type-three', 'type-four'])
)
);
Expand Down Expand Up @@ -82,7 +83,7 @@ describe('saved_objects_count_collector', () => {

expect(getSavedObjectsCountsMock).toHaveBeenCalledWith(
fetchContextMock.esClient,
kibanaIndex,
[kibanaIndex],
['type_one', 'type_two', 'type-three', 'type-four'],
false
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const MOCK_USAGE_STATS: UsageStats = {
};

const kibanaIndex = '.kibana-tests';
const getIndexForType = () => Promise.resolve(kibanaIndex);

function setup({
license = { isAvailable: true },
Expand Down Expand Up @@ -122,7 +123,7 @@ describe('error handling', () => {
license: { isAvailable: true, type: 'basic' },
});
const collector = getSpacesUsageCollector(usageCollection as any, {
kibanaIndex,
getIndexForType,
features,
licensing,
usageStatsServicePromise: Promise.resolve(usageStatsService),
Expand All @@ -146,7 +147,7 @@ describe('with a basic license', () => {

beforeAll(async () => {
const collector = getSpacesUsageCollector(usageCollection as any, {
kibanaIndex,
getIndexForType,
features,
licensing,
usageStatsServicePromise: Promise.resolve(usageStatsService),
Expand Down Expand Up @@ -205,7 +206,7 @@ describe('with no license', () => {

beforeAll(async () => {
const collector = getSpacesUsageCollector(usageCollection as any, {
kibanaIndex,
getIndexForType,
features,
licensing,
usageStatsServicePromise: Promise.resolve(usageStatsService),
Expand Down Expand Up @@ -246,7 +247,7 @@ describe('with platinum license', () => {

beforeAll(async () => {
const collector = getSpacesUsageCollector(usageCollection as any, {
kibanaIndex,
getIndexForType,
features,
licensing,
usageStatsServicePromise: Promise.resolve(usageStatsService),
Expand Down

0 comments on commit 8466aa5

Please sign in to comment.