Skip to content

Commit

Permalink
Updating test setup for lifecycle_handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
legrego committed Dec 8, 2020
1 parent 341d948 commit f3dd0ba
Showing 1 changed file with 31 additions and 20 deletions.
51 changes: 31 additions & 20 deletions src/core/server/http/integration_tests/lifecycle_handlers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,37 @@ describe('core lifecycle handlers', () => {

beforeEach(async () => {
const configService = configServiceMock.create();
configService.atPath.mockReturnValue(
new BehaviorSubject({
hosts: ['localhost'],
maxPayload: new ByteSizeValue(1024),
autoListen: true,
ssl: {
enabled: false,
},
compression: { enabled: true },
name: kibanaName,
customResponseHeaders: {
'some-header': 'some-value',
},
xsrf: { disableProtection: false, allowlist: [allowlistedTestPath] },
requestId: {
allowFromAnyIp: true,
ipAllowlist: [],
},
} as any)
);
configService.atPath.mockImplementation((path) => {
if (path === 'server') {
return new BehaviorSubject({
hosts: ['localhost'],
maxPayload: new ByteSizeValue(1024),
autoListen: true,
ssl: {
enabled: false,
},
compression: { enabled: true },
name: kibanaName,
customResponseHeaders: {
'some-header': 'some-value',
},
xsrf: { disableProtection: false, allowlist: [allowlistedTestPath] },
requestId: {
allowFromAnyIp: true,
ipAllowlist: [],
},
} as any);
}
if (path === 'externalUrl') {
return new BehaviorSubject({
policy: [],
} as any);
}
if (path === 'csp') {
return new BehaviorSubject({} as any);
}
throw new Error(`Unexpected config path: ${path}`);
});
server = createHttpServer({ configService });

const serverSetup = await server.setup(setupDeps);
Expand Down

0 comments on commit f3dd0ba

Please sign in to comment.