-
Notifications
You must be signed in to change notification settings - Fork 29.9k
/
react-ga-tests.ts
99 lines (84 loc) · 2.54 KB
/
react-ga-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import * as ga from "react-ga";
declare function describe(desc: string, f: () => void): void;
declare function it(desc: string, f: () => void): void;
describe("Testing react-ga initialize object", () => {
it("Able to initialize react-ga object", () => {
ga.initialize("UA-65432-1");
});
it("Able to initailize react-ga object", () => {
const options: ga.InitializeOptions = {
debug: true,
};
ga.initialize("UA-65432-1", options);
});
});
describe("Testing react-ga pageview calls", () => {
it("Able to make pageview calls", () => {
ga.initialize("UA-65432-1");
ga.pageview("http://telshin.com");
});
});
describe("Testing react-ga modal calls", () => {
it("Able to make modal calls", () => {
ga.initialize("UA-65432-1");
ga.modalview("Test modal");
});
});
describe("Testing react-ga event calls", () => {
it("Able to make event calls", () => {
ga.initialize("UA-65432-1");
const options: ga.EventArgs = {
category: "Test",
action: "CI",
label: "Running Jasmine tests for react-ga typscript library",
value: 4,
nonInteraction: true,
};
ga.event(options);
});
});
describe("Testing react-ga set calls", () => {
it("Able to make set calls", () => {
ga.initialize("UA-65432-1");
const fieldObject: ga.FieldsObject = {
page: '/users'
};
ga.set(fieldObject);
});
});
describe("Testing react-ga v2.1.2", () => {
it("Able to make ga calls", () => {
ga.ga();
});
it("Able to make send calls", () => {
const fieldObject: ga.FieldsObject = {
page: '/users'
};
ga.send(fieldObject);
});
it("Able to make timing calls", () => {
ga.timing({
category: 'string',
variable: 'string',
value: 1,
label: 'string'
});
});
it("Able to make exception calls", () => {
const fieldObject: ga.FieldsObject = {
page: '/users'
};
ga.exception(fieldObject);
});
it("Able to make plugin object calls", () => {
const execute = ga.plugin.execute;
const require = ga.plugin.require;
const payload = {};
execute('name', 'action', payload);
execute('name', 'action', 'type', payload);
require('name', {});
});
it("Able to make outboundLink calls", () => {
ga.outboundLink({label: 'string'}, () => {});
});
});