fix(analytics): allow tracking static pages events when the user is not authenticated

This commit is contained in:
Matteo Pagliazzi
2020-11-29 20:15:12 +01:00
parent 103b4cb8a8
commit 6b3a6eb59f
2 changed files with 2 additions and 11 deletions

View File

@@ -1,19 +1,10 @@
import {
generateUser,
requester,
translate as t,
} from '../../../../helpers/api-integration/v3';
import { mockAnalyticsService as analytics } from '../../../../../website/server/libs/analyticsService';
describe('POST /analytics/track/:eventName', () => {
it('requires authentication', async () => {
await expect(requester().post('/analytics/track/event')).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('missingAuthHeaders'),
});
});
it('calls res.analytics', async () => {
const user = await generateUser();
sandbox.spy(analytics, 'track');