Skip to content

Commit d9d27b8

Browse files
committed
fixes proxy mock object in unit test
1 parent 45814dc commit d9d27b8

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

x-pack/plugins/apm/server/lib/traces/__snapshots__/queries.test.ts.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/apm/server/utils/test_helpers.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ export async function inspectSearchParams(
5959
let response;
6060
let error;
6161

62+
const mockApmIndices = {
63+
sourcemaps: 'myIndex',
64+
errors: 'myIndex',
65+
onboarding: 'myIndex',
66+
spans: 'myIndex',
67+
transactions: 'myIndex',
68+
metrics: 'myIndex',
69+
};
6270
const mockSetup = {
6371
apmEventClient: { search: spy } as any,
6472
internalClient: { search: spy } as any,
@@ -75,7 +83,13 @@ export async function inspectSearchParams(
7583
default:
7684
return 'myIndex';
7785
case 'indices':
78-
return new Proxy({}, { get: () => 'myIndex' });
86+
return mockApmIndices;
87+
case 'ui':
88+
return {
89+
enabled: true,
90+
transactionGroupBucketSize: 1000,
91+
maxTraceItems: 1000,
92+
};
7993
case 'metricsInterval':
8094
return 30;
8195
}
@@ -84,12 +98,7 @@ export async function inspectSearchParams(
8498
) as APMConfig,
8599
uiFilters: options?.uiFilters ?? {},
86100
indices: {
87-
sourcemaps: 'myIndex',
88-
errors: 'myIndex',
89-
onboarding: 'myIndex',
90-
spans: 'myIndex',
91-
transactions: 'myIndex',
92-
metrics: 'myIndex',
101+
...mockApmIndices,
93102
apmAgentConfigurationIndex: 'myIndex',
94103
apmCustomLinkIndex: 'myIndex',
95104
},

0 commit comments

Comments
 (0)