Skip to content

Commit

Permalink
fixes proxy mock object in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
ogupte committed Oct 12, 2021
1 parent 45814dc commit d9d27b8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 16 additions & 7 deletions x-pack/plugins/apm/server/utils/test_helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ export async function inspectSearchParams(
let response;
let error;

const mockApmIndices = {
sourcemaps: 'myIndex',
errors: 'myIndex',
onboarding: 'myIndex',
spans: 'myIndex',
transactions: 'myIndex',
metrics: 'myIndex',
};
const mockSetup = {
apmEventClient: { search: spy } as any,
internalClient: { search: spy } as any,
Expand All @@ -75,7 +83,13 @@ export async function inspectSearchParams(
default:
return 'myIndex';
case 'indices':
return new Proxy({}, { get: () => 'myIndex' });
return mockApmIndices;
case 'ui':
return {
enabled: true,
transactionGroupBucketSize: 1000,
maxTraceItems: 1000,
};
case 'metricsInterval':
return 30;
}
Expand All @@ -84,12 +98,7 @@ export async function inspectSearchParams(
) as APMConfig,
uiFilters: options?.uiFilters ?? {},
indices: {
sourcemaps: 'myIndex',
errors: 'myIndex',
onboarding: 'myIndex',
spans: 'myIndex',
transactions: 'myIndex',
metrics: 'myIndex',
...mockApmIndices,
apmAgentConfigurationIndex: 'myIndex',
apmCustomLinkIndex: 'myIndex',
},
Expand Down

0 comments on commit d9d27b8

Please sign in to comment.