Skip to content

Commit f3dd0ba

Browse files
committed
Updating test setup for lifecycle_handlers
1 parent 341d948 commit f3dd0ba

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

src/core/server/http/integration_tests/lifecycle_handlers.test.ts

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,37 @@ describe('core lifecycle handlers', () => {
5050

5151
beforeEach(async () => {
5252
const configService = configServiceMock.create();
53-
configService.atPath.mockReturnValue(
54-
new BehaviorSubject({
55-
hosts: ['localhost'],
56-
maxPayload: new ByteSizeValue(1024),
57-
autoListen: true,
58-
ssl: {
59-
enabled: false,
60-
},
61-
compression: { enabled: true },
62-
name: kibanaName,
63-
customResponseHeaders: {
64-
'some-header': 'some-value',
65-
},
66-
xsrf: { disableProtection: false, allowlist: [allowlistedTestPath] },
67-
requestId: {
68-
allowFromAnyIp: true,
69-
ipAllowlist: [],
70-
},
71-
} as any)
72-
);
53+
configService.atPath.mockImplementation((path) => {
54+
if (path === 'server') {
55+
return new BehaviorSubject({
56+
hosts: ['localhost'],
57+
maxPayload: new ByteSizeValue(1024),
58+
autoListen: true,
59+
ssl: {
60+
enabled: false,
61+
},
62+
compression: { enabled: true },
63+
name: kibanaName,
64+
customResponseHeaders: {
65+
'some-header': 'some-value',
66+
},
67+
xsrf: { disableProtection: false, allowlist: [allowlistedTestPath] },
68+
requestId: {
69+
allowFromAnyIp: true,
70+
ipAllowlist: [],
71+
},
72+
} as any);
73+
}
74+
if (path === 'externalUrl') {
75+
return new BehaviorSubject({
76+
policy: [],
77+
} as any);
78+
}
79+
if (path === 'csp') {
80+
return new BehaviorSubject({} as any);
81+
}
82+
throw new Error(`Unexpected config path: ${path}`);
83+
});
7384
server = createHttpServer({ configService });
7485

7586
const serverSetup = await server.setup(setupDeps);

0 commit comments

Comments
 (0)