angulartics2
angulartics2 copied to clipboard
Provide Unit test guidance
For support questions, please consider using Gitter - Chat
I'm submitting a ...
-
[ ] bug report
-
[X] feature request
-
[ ] question about the decisions made in the repository
-
What is the expected behavior? There is no documentation or code to help out mock the Analytics. If there are, please put them in your README or wiki.
-
What is the motivation / use case for changing the behavior? I have written a mock for the following, but maybe it would need more.
@Injectable()
export class Angulartics2Mock {
settings = {};
setUsername = new ReplaySubject<string | {
userId: string | number;
}>();
setUserProperties = new ReplaySubject<any>();
}
@Injectable()
export class Angulartics2GoogleAnalyticsMock extends Angulartics2GoogleAnalytics {
constructor(
angulartics2: Angulartics2
) {
super(angulartics2);
}
startTracking(): void { }
pageTrack(path: string): void { }
eventTrack(action: string, properties: any): void { }
exceptionTrack(properties: any): void { }
userTimings(properties: UserTimings): void { }
setUsername(userId: string): void { }
setUserProperties(properties: any): void { }
}
- Environment:
Angular CLI: 9.1.0
Node: 12.3.1
OS: win32 x64
Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.901.0
@angular-devkit/build-angular 0.901.0
@angular-devkit/build-optimizer 0.901.0
@angular-devkit/build-webpack 0.901.0
@angular-devkit/core 9.1.0
@angular-devkit/schematics 9.1.0
@angular/cdk 9.2.0
@angular/material 9.2.0
@ngtools/webpack 9.1.0
@schematics/angular 9.1.0
@schematics/update 0.901.0
rxjs 6.5.4
typescript 3.8.3
webpack 4.42.0