Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return start({}, { routes }, mockConfig).then(server => {
const avro = require('mwp-tracking-plugin/lib/util/avro');
avro.loggers.click.mockReturnValue('mocked clicktracking log');
const request = {
method: 'get',
url: '/ny-tech',
credentials: 'whatever',
headers: { cookie },
};
return server
.inject(request)
.then(response => {
const cookieUnsetString = 'click-track=;';
expect(avro.loggers.click).toHaveBeenCalledTimes(
clickData.history.length
);
expect(response.headers['set-cookie']).toContainEqual(
expect.stringContaining(cookieUnsetString)
);
.then(response => {
const cookieUnsetString = 'click-track=;';
expect(avro.loggers.click).toHaveBeenCalledTimes(
clickData.history.length
);
expect(response.headers['set-cookie']).toContainEqual(
expect.stringContaining(cookieUnsetString)
);
})
.then(() => server.stop())