Skip to content

Commit

Permalink
Update A2 case based on Slack convo
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasMassart committed Aug 20, 2024
1 parent 93b0866 commit 8cf34d2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions app/core/Analytics/MetaMetrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,19 @@ describe('MetaMetrics', () => {
* | NA1 | NA | NO | NO | EMPTY | NONE |
* | A1 | A | NO | NO | EMPTY | NONE |
* | NA2 | NA | YES | NO | NA PROPS | NONE |
* | A2 | A | YES | NO | EMPTY | NA PROPS |
* | A2 | A | YES | NO | NA PROPS | NONE |
* | NA3 | NA | NO | YES | EMPTY | A PROPS |
* | A3 | A | NO | YES | EMPTY | A PROPS |
* | NA4 | NA | YES | YES | NA PROPS | NA PROPS + A PROPS |
* | A4 | A | YES | YES | NA PROPS | NA PROPS + A PROPS |
*
* the following test cases include the code (NAX or AX) of the test in the table for reference.
*
* NOTE: some NAX and AX test cases (all except NA2/A2) have similar result but differ only by calling the
* NOTE: NAX and AX test cases have similar result but differ only by calling the
* anonymous (trackAnonymousEvent) or non-anonymous tracking (trackEvent).
* They are grouped together here and both implementations uses trackEvent under the hood.
* Ultimately these duplicates will disappear when we deprecate trackAnonymousEvent.
* But that's another issue to address.
* But that's another issue to address, for now let's keep it simple and double test.
*/
describe('tracks non-anonymous event (NA)', () => {
it('without properties (NA1)', async () => {
Expand Down Expand Up @@ -330,15 +330,12 @@ describe('MetaMetrics', () => {
const { segmentMockClient } =
global as unknown as GlobalWithSegmentClient;

// check if the event was tracked
expect(segmentMockClient.track).toHaveBeenCalledWith(event.category, {
anonymous: false,
...{},
});
expect(segmentMockClient.track).toHaveBeenCalledWith(event.category, {
anonymous: true,
...nonAnonProp,
});
expect(segmentMockClient.track).toHaveBeenCalledTimes(2);
expect(segmentMockClient.track).toHaveBeenCalledTimes(1);
});

it('with only anonymous properties (A3)', async () => {
Expand Down

0 comments on commit 8cf34d2

Please sign in to comment.