Skip to content

Commit

Permalink
fix cookie session storage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
legrego committed Dec 8, 2020
1 parent 761e063 commit c8b8dfe
Showing 1 changed file with 34 additions and 23 deletions.
57 changes: 34 additions & 23 deletions src/core/server/http/cookie_session_storage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,40 @@ const setupDeps = {
context: contextSetup,
};

configService.atPath.mockReturnValue(
new BehaviorSubject({
hosts: ['http://1.2.3.4'],
maxPayload: new ByteSizeValue(1024),
autoListen: true,
healthCheck: {
delay: 2000,
},
ssl: {
verificationMode: 'none',
},
compression: { enabled: true },
xsrf: {
disableProtection: true,
allowlist: [],
},
customResponseHeaders: {},
requestId: {
allowFromAnyIp: true,
ipAllowlist: [],
},
} as any)
);
configService.atPath.mockImplementation((path) => {
if (path === 'server') {
return new BehaviorSubject({
hosts: ['http://1.2.3.4'],
maxPayload: new ByteSizeValue(1024),
autoListen: true,
healthCheck: {
delay: 2000,
},
ssl: {
verificationMode: 'none',
},
compression: { enabled: true },
xsrf: {
disableProtection: true,
allowlist: [],
},
customResponseHeaders: {},
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}`);
});

beforeEach(() => {
logger = loggingSystemMock.create();
Expand Down

0 comments on commit c8b8dfe

Please sign in to comment.