Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('renders the expected app content for nested path of mock app route config', () => {
return start(getMockRenderRequestMap(), {}).then(server => {
const request = {
method: 'get',
url: '/foo/bar?heyhey=true',
credentials: 'whatever',
};
return server
.inject(request)
.then(response => {
expect(response.payload).toContain(fooPathContent);
expect(response.payload).not.toContain(ROOT_INDEX_CONTENT);
expect(response.payload).toContain(fakeApiProxyResponse);
expect(
response.headers['set-cookie'].find(h =>
h.startsWith('x-mwp-csrf-header')
)
).not.toBeUndefined();
const testSideEffectError = (Component, name) =>
start(getMockRenderRequestMap(), {}).then(server => {
const request = {
method: 'get',
url: `/badImplementation?${name}`,
credentials: 'whatever',
};
return server
.inject(request)
.then(response => {
expect(response.statusCode === 500);
expect(Component.rewind).toHaveBeenCalled();
})
.then(() => server.stop())
.catch(err => {
server.stop();
throw err;
});