Skip to content

Commit

Permalink
Create analytics.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 3, 2024
1 parent 0f1b05d commit e66bbfe
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/analytics.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// tests/analytics.test.js
const Analytics = require('../analytics'); // Assuming you have an analytics module

describe('Analytics Module', () => {
test('should track user activity correctly', () => {
const activity = { userId: 'user123', action: 'login' };
Analytics.trackActivity(activity);
expect(Analytics.getActivityLog()).toContainEqual(activity);
});

test('should return correct analytics data', () => {
const data = Analytics.getAnalyticsData();
expect(data).toHaveProperty('totalUsers');
expect(data.totalUsers).toBeGreaterThan(0);
});
});

0 comments on commit e66bbfe

Please sign in to comment.