Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return [api.complete([])];
}
// perform a fast comparison of previous route's serialized queries
// with the new route's serialized queries. All state refs for
// _shared_ queries should be retained
const serializedNew = newQueries.map(JSON.stringify);
const serializedPrev = previousQueries.map(JSON.stringify);
const sharedRefs = serializedPrev
.filter(qJSON => serializedNew.includes(qJSON))
.map(JSON.parse)
.map(q => q.ref);
requestMetadata.retainRefs = sharedRefs;
return [
cacheAction,
api.get(newQueries, requestMetadata),
clickActions.clear(),
].filter(a => a);
}
);
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())
componentDidMount() {
initClickTracking();
}
render() {
export const clickTrackEnhancer = createStore => (
reducer,
initialState,
enhancer
) => {
const store = createStore(reducer, initialState, enhancer);
const clickTracker = getClickWriter(store);
document.body.addEventListener('click', clickTracker);
document.body.addEventListener('change', clickTracker);
return store;
};