Skip to content

Commit

Permalink
feat(posthog): add test for setting group
Browse files Browse the repository at this point in the history
  • Loading branch information
radanovicnikola committed Jul 18, 2024
1 parent f62f618 commit 9c9f74f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib/providers/posthog/posthog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ describe('Angulartics2Posthog', () => {
capture: jasmine.createSpy('capture'),
identify: jasmine.createSpy('identify'),
alias: jasmine.createSpy('alias'),
group: jasmine.createSpy('group'),
};

const provider: Angulartics2Posthog = TestBed.inject(Angulartics2Posthog);
Expand Down Expand Up @@ -166,4 +167,16 @@ describe('Angulartics2Posthog', () => {
},
),
));

it('should set group properties', fakeAsync(
inject(
[Angulartics2, Angulartics2Posthog],
(angulartics2: Angulartics2, angulartics2Posthog: Angulartics2Posthog) => {
fixture = createRoot(RootCmp);
angulartics2Posthog.setGroup('company', '123', { name: 'Company name' });
advance(fixture);
expect(posthog.group).toHaveBeenCalledWith('company', '123', { name: 'Company name' });
}
)
))
});

0 comments on commit 9c9f74f

Please sign in to comment.