@snowplow/react-native-tracker 1.4.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +15 -0
- package/.eslintignore +6 -0
- package/.gitattributes +3 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/.github/actions/setup/action.yml +28 -0
- package/.github/workflows/build.yml +155 -0
- package/.github/workflows/deploy.yml +97 -0
- package/.github/workflows/e2e-android.yml +121 -0
- package/.github/workflows/e2e-ios.yml +95 -0
- package/.github/workflows/snyk.yml +21 -0
- package/.gitignore +70 -0
- package/.npmignore +60 -0
- package/.nvmrc +1 -0
- package/.watchmanconfig +1 -0
- package/.yarnrc +3 -0
- package/CHANGELOG +176 -0
- package/CONTRIBUTING.md +80 -0
- package/LICENSE +1 -1
- package/README.md +24 -111
- package/android/build.gradle +93 -37
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -2
- package/android/gradle.properties +5 -2
- package/android/gradlew +172 -110
- package/android/gradlew.bat +24 -19
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerModule.kt +744 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerPackage.kt +17 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/util/ConfigUtil.kt +274 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/util/EventUtil.kt +233 -0
- package/android/src/main/java/com/snowplow/reactnativetracker/util/TrackerVersion.kt +5 -0
- package/babel.config.js +3 -0
- package/example/.watchmanconfig +1 -0
- package/example/Gemfile +6 -0
- package/example/android/app/build.gradle +129 -0
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +10 -0
- package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTest.java +36 -0
- package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTestAppJUnitRunner.java +21 -0
- package/example/android/app/src/debug/AndroidManifest.xml +13 -0
- package/example/android/app/src/debug/java/com/reactnativetrackerexample/ReactNativeFlipper.java +75 -0
- package/example/android/app/src/main/AndroidManifest.xml +26 -0
- package/example/android/app/src/main/java/com/reactnativetrackerexample/MainActivity.java +32 -0
- package/example/android/app/src/main/java/com/reactnativetrackerexample/MainApplication.java +62 -0
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/values/strings.xml +3 -0
- package/example/android/app/src/main/res/values/styles.xml +9 -0
- package/example/android/app/src/release/java/com/reactnativetrackerexample/ReactNativeFlipper.java +20 -0
- package/example/android/build.gradle +31 -0
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/example/android/gradle.properties +44 -0
- package/example/android/gradlew +244 -0
- package/example/android/gradlew.bat +92 -0
- package/example/android/settings.gradle +4 -0
- package/example/app.json +4 -0
- package/example/babel.config.js +17 -0
- package/example/detox.config.js +92 -0
- package/example/e2e/config.json +10 -0
- package/example/e2e/emitEvents.e2e.detox.js +95 -0
- package/example/e2e/environment.js +23 -0
- package/example/e2e/helpers/microCommands.js +140 -0
- package/example/e2e/helpers/microHelpers.js +333 -0
- package/example/e2e/helpers/microHelpers.test.js +295 -0
- package/example/e2e/helpers/schemas.js +49 -0
- package/example/e2e/jest.config.js +16 -0
- package/example/e2e/setup.js +4 -0
- package/example/e2e/testEvents.micro.test.js +287 -0
- package/example/index.js +5 -0
- package/example/ios/.xcode.env +11 -0
- package/example/ios/Podfile +62 -0
- package/example/ios/Podfile.lock +730 -0
- package/example/ios/ReactNativeTrackerExample/AppDelegate.h +6 -0
- package/example/ios/ReactNativeTrackerExample/AppDelegate.mm +26 -0
- package/example/ios/ReactNativeTrackerExample/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/example/ios/ReactNativeTrackerExample/Images.xcassets/Contents.json +6 -0
- package/example/ios/ReactNativeTrackerExample/Info.plist +55 -0
- package/example/ios/ReactNativeTrackerExample/LaunchScreen.storyboard +47 -0
- package/example/ios/ReactNativeTrackerExample/main.m +10 -0
- package/example/ios/ReactNativeTrackerExample-Bridging-Header.h +3 -0
- package/example/ios/ReactNativeTrackerExample.xcodeproj/project.pbxproj +722 -0
- package/{ios/RNSnowplowTracker.xcodeproj/xcshareddata/xcschemes/RNSnowplowTracker.xcscheme → example/ios/ReactNativeTrackerExample.xcodeproj/xcshareddata/xcschemes/ReactNativeTrackerExample.xcscheme} +29 -21
- package/example/ios/ReactNativeTrackerExample.xcworkspace/contents.xcworkspacedata +10 -0
- package/example/ios/ReactNativeTrackerExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/example/ios/ReactNativeTrackerExampleTests/Info.plist +24 -0
- package/example/ios/ReactNativeTrackerExampleTests/ReactNativeTrackerExampleTests.m +66 -0
- package/example/metro.config.js +45 -0
- package/example/package.json +54 -0
- package/example/react-native.config.js +10 -0
- package/example/src/App.js +566 -0
- package/example/tsconfig.json +5 -0
- package/example/yarn.lock +7379 -0
- package/ios/ReactNativeTracker-Bridging-Header.h +2 -0
- package/ios/ReactNativeTracker.mm +175 -0
- package/ios/ReactNativeTracker.swift +822 -0
- package/ios/{RNSnowplowTracker.xcodeproj → ReactNativeTracker.xcodeproj}/project.pbxproj +55 -79
- package/ios/Util/ConfigUtils.swift +209 -0
- package/ios/Util/TrackerVersion.swift +3 -0
- package/ios/Util/Utilities.swift +37 -0
- package/lefthook.yml +11 -0
- package/lib/commonjs/api.js +490 -0
- package/lib/commonjs/api.js.map +1 -0
- package/lib/commonjs/configurations.js +196 -0
- package/lib/commonjs/configurations.js.map +1 -0
- package/lib/commonjs/constants.js +77 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/events.js +277 -0
- package/lib/commonjs/events.js.map +1 -0
- package/lib/commonjs/index.js +132 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/jsCore.js +427 -0
- package/lib/commonjs/jsCore.js.map +1 -0
- package/lib/commonjs/native.js +16 -0
- package/lib/commonjs/native.js.map +1 -0
- package/lib/commonjs/subject.js +235 -0
- package/lib/commonjs/subject.js.map +1 -0
- package/lib/commonjs/tracker.js +248 -0
- package/lib/commonjs/tracker.js.map +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +72 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/commonjs/webViewInterface.js +66 -0
- package/lib/commonjs/webViewInterface.js.map +1 -0
- package/lib/module/api.js +452 -0
- package/lib/module/api.js.map +1 -0
- package/lib/module/configurations.js +184 -0
- package/lib/module/configurations.js.map +1 -0
- package/lib/module/constants.js +72 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/events.js +259 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/index.js +120 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/jsCore.js +424 -0
- package/lib/module/jsCore.js.map +1 -0
- package/lib/module/native.js +12 -0
- package/lib/module/native.js.map +1 -0
- package/lib/module/subject.js +222 -0
- package/lib/module/subject.js.map +1 -0
- package/lib/module/tracker.js +234 -0
- package/lib/module/tracker.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +66 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/webViewInterface.js +62 -0
- package/lib/module/webViewInterface.js.map +1 -0
- package/lib/typescript/__tests__/api.test.d.ts +2 -0
- package/lib/typescript/__tests__/api.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/configurations.test.d.ts +2 -0
- package/lib/typescript/__tests__/configurations.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/events.test.d.ts +2 -0
- package/lib/typescript/__tests__/events.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/index.test.d.ts +2 -0
- package/lib/typescript/__tests__/index.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/jsCore.test.d.ts +2 -0
- package/lib/typescript/__tests__/jsCore.test.d.ts.map +1 -0
- package/lib/typescript/__tests__/utils.test.d.ts +2 -0
- package/lib/typescript/__tests__/utils.test.d.ts.map +1 -0
- package/lib/typescript/api.d.ts +240 -0
- package/lib/typescript/api.d.ts.map +1 -0
- package/lib/typescript/configurations.d.ts +73 -0
- package/lib/typescript/configurations.d.ts.map +1 -0
- package/lib/typescript/constants.d.ts +64 -0
- package/lib/typescript/constants.d.ts.map +1 -0
- package/lib/typescript/events.d.ts +115 -0
- package/lib/typescript/events.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +27 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/jsCore.d.ts +152 -0
- package/lib/typescript/jsCore.d.ts.map +1 -0
- package/lib/typescript/native.d.ts +4 -0
- package/lib/typescript/native.d.ts.map +1 -0
- package/lib/typescript/subject.d.ts +91 -0
- package/lib/typescript/subject.d.ts.map +1 -0
- package/lib/typescript/tracker.d.ts +111 -0
- package/lib/typescript/tracker.d.ts.map +1 -0
- package/{dist/index.d.ts → lib/typescript/types.d.ts} +264 -73
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils.d.ts +35 -0
- package/lib/typescript/utils.d.ts.map +1 -0
- package/lib/typescript/webViewInterface.d.ts +15 -0
- package/lib/typescript/webViewInterface.d.ts.map +1 -0
- package/package.json +135 -53
- package/scripts/bootstrap.js +29 -0
- package/snowplow-react-native-tracker.podspec +42 -0
- package/src/__mocks__/react-native.js +7 -0
- package/src/__tests__/api.test.ts +21 -0
- package/src/__tests__/configurations.test.ts +608 -0
- package/src/__tests__/events.test.ts +736 -0
- package/src/__tests__/index.test.ts +14 -0
- package/src/__tests__/jsCore.test.ts +199 -0
- package/src/__tests__/utils.test.ts +10 -0
- package/src/api.ts +556 -0
- package/src/configurations.ts +325 -0
- package/src/constants.ts +97 -0
- package/src/events.ts +355 -0
- package/src/index.ts +184 -0
- package/src/jsCore.ts +603 -0
- package/src/native.ts +21 -0
- package/src/subject.ts +302 -0
- package/src/tracker.ts +377 -0
- package/src/types.ts +1162 -0
- package/src/utils.ts +65 -0
- package/src/webViewInterface.ts +92 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +28 -0
- package/turbo.json +34 -0
- package/yarn.lock +9333 -0
- package/RNSnowplowTracker.podspec +0 -24
- package/android/src/main/java/com/snowplowanalytics/react/tracker/RNSnowplowTrackerModule.java +0 -750
- package/android/src/main/java/com/snowplowanalytics/react/tracker/RNSnowplowTrackerPackage.java +0 -29
- package/android/src/main/java/com/snowplowanalytics/react/util/ConfigUtil.java +0 -351
- package/android/src/main/java/com/snowplowanalytics/react/util/EventUtil.java +0 -339
- package/android/src/main/java/com/snowplowanalytics/react/util/TrackerVersion.java +0 -7
- package/dist/index.js +0 -2026
- package/dist/index.js.map +0 -1
- package/ios/RNSnowplowTracker.h +0 -34
- package/ios/RNSnowplowTracker.m +0 -911
- package/ios/Util/NSDictionary+RNSP_TypeMethods.h +0 -33
- package/ios/Util/NSDictionary+RNSP_TypeMethods.m +0 -40
- package/ios/Util/RNConfigUtils.h +0 -44
- package/ios/Util/RNConfigUtils.m +0 -209
- package/ios/Util/RNTrackerVersion.h +0 -27
- package/ios/Util/RNTrackerVersion.m +0 -27
- package/ios/Util/RNUtilities.h +0 -32
- package/ios/Util/RNUtilities.m +0 -68
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
import * as e from '../events';
|
|
2
|
+
import { logMessages } from '../constants';
|
|
3
|
+
|
|
4
|
+
describe('test isValidSD', () => {
|
|
5
|
+
test('test invalid type', () => {
|
|
6
|
+
const testSD = undefined as any;
|
|
7
|
+
expect(e.isValidSD(testSD)).toBe(false);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test('test invalid - no keys', () => {
|
|
11
|
+
const testSD = {} as any;
|
|
12
|
+
expect(e.isValidSD(testSD)).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('test invalid schema', () => {
|
|
16
|
+
const testSD = {
|
|
17
|
+
schema: null,
|
|
18
|
+
data: { test: 'test' },
|
|
19
|
+
} as any;
|
|
20
|
+
expect(e.isValidSD(testSD)).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('test invalid data', () => {
|
|
24
|
+
const testSD = {
|
|
25
|
+
schema: 'testSchema',
|
|
26
|
+
data: undefined,
|
|
27
|
+
} as any;
|
|
28
|
+
expect(e.isValidSD(testSD)).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('test valid', () => {
|
|
32
|
+
const testSD = {
|
|
33
|
+
schema: 'testSchema',
|
|
34
|
+
data: {
|
|
35
|
+
test: 'valid',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
expect(e.isValidSD(testSD)).toBe(true);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('test validateContexts', () => {
|
|
43
|
+
test('test invalid type', async () => {
|
|
44
|
+
const testContexts = 'notArray' as any;
|
|
45
|
+
await expect(e.validateContexts(testContexts)).rejects.toThrow(
|
|
46
|
+
logMessages.context
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('test invalid contexts', async () => {
|
|
51
|
+
const testContexts = [
|
|
52
|
+
{ schema: 'test', data: { test: 'test' } },
|
|
53
|
+
{ schema: null, data: { test: 'invalid' } },
|
|
54
|
+
] as any;
|
|
55
|
+
await expect(e.validateContexts(testContexts)).rejects.toThrow(
|
|
56
|
+
logMessages.context
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('test valid contexts - empty', async () => {
|
|
61
|
+
const testContexts = [] as any;
|
|
62
|
+
await expect(e.validateContexts(testContexts)).resolves.toBe(true);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('test valid contexts', async () => {
|
|
66
|
+
const testContexts = [
|
|
67
|
+
{ schema: 'test', data: { test: 'test' } },
|
|
68
|
+
{ schema: 'test', data: { test: 'valid' } },
|
|
69
|
+
];
|
|
70
|
+
await expect(e.validateContexts(testContexts)).resolves.toBe(true);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('test validateSelfDesc', () => {
|
|
75
|
+
test('test invalid self-describing - wrong type', async () => {
|
|
76
|
+
const testEv = undefined as any;
|
|
77
|
+
await expect(e.validateSelfDesc(testEv)).rejects.toThrow(
|
|
78
|
+
logMessages.selfDesc
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('test invalid self-describing - empty object', async () => {
|
|
83
|
+
const testEv = {} as any;
|
|
84
|
+
await expect(e.validateSelfDesc(testEv)).rejects.toThrow(
|
|
85
|
+
logMessages.selfDesc
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('test valid self-describing', async () => {
|
|
90
|
+
const testEv = { schema: 'test', data: { test: 'test' } };
|
|
91
|
+
await expect(e.validateSelfDesc(testEv)).resolves.toBe(true);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('test validateScreenView', () => {
|
|
96
|
+
test('test invalid screen-view - wrong type', async () => {
|
|
97
|
+
const testEv = null as any;
|
|
98
|
+
await expect(e.validateScreenView(testEv)).rejects.toThrow(
|
|
99
|
+
logMessages.evType
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('test invalid screen-view - missing name', async () => {
|
|
104
|
+
const testEv = { type: 'test' } as any;
|
|
105
|
+
await expect(e.validateScreenView(testEv)).rejects.toThrow(
|
|
106
|
+
logMessages.screenViewReq
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('test invalid screen-view - wrong name', async () => {
|
|
111
|
+
const testEv = { name: null } as any;
|
|
112
|
+
await expect(e.validateScreenView(testEv)).rejects.toThrow(
|
|
113
|
+
logMessages.screenViewReq
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
test('test valid screen-view', async () => {
|
|
118
|
+
const testEv = {
|
|
119
|
+
name: 'test',
|
|
120
|
+
type: 'test',
|
|
121
|
+
previousName: 'preTest',
|
|
122
|
+
transitionType: 'testing',
|
|
123
|
+
};
|
|
124
|
+
await expect(e.validateScreenView(testEv)).resolves.toBe(true);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
describe('test validateStructured', () => {
|
|
129
|
+
test('test invalid structured - wrong type', async () => {
|
|
130
|
+
const testEv = undefined as any;
|
|
131
|
+
await expect(e.validateStructured(testEv)).rejects.toThrow(
|
|
132
|
+
logMessages.evType
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test('test invalid structured - missing category', async () => {
|
|
137
|
+
const testEv = { action: 'test' } as any;
|
|
138
|
+
await expect(e.validateStructured(testEv)).rejects.toThrow(
|
|
139
|
+
logMessages.structuredReq
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test('test invalid structured - missing action', async () => {
|
|
144
|
+
const testEv = { category: 'test' } as any;
|
|
145
|
+
await expect(e.validateStructured(testEv)).rejects.toThrow(
|
|
146
|
+
logMessages.structuredReq
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test('test invalid structured - wrong category', async () => {
|
|
151
|
+
const testEv = { category: null } as any;
|
|
152
|
+
await expect(e.validateStructured(testEv)).rejects.toThrow(
|
|
153
|
+
logMessages.structuredReq
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('test invalid structured - wrong action', async () => {
|
|
158
|
+
const testEv = { action: undefined } as any;
|
|
159
|
+
await expect(e.validateStructured(testEv)).rejects.toThrow(
|
|
160
|
+
logMessages.structuredReq
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test('test valid structured', async () => {
|
|
165
|
+
const testEv = {
|
|
166
|
+
category: 'test',
|
|
167
|
+
action: 'test',
|
|
168
|
+
label: 'test',
|
|
169
|
+
property: 'test',
|
|
170
|
+
value: 0,
|
|
171
|
+
};
|
|
172
|
+
await expect(e.validateStructured(testEv)).resolves.toBe(true);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
describe('test validatePageView', () => {
|
|
177
|
+
test('test invalid page-view - wrong type', async () => {
|
|
178
|
+
const testEv = 'pageView' as any;
|
|
179
|
+
await expect(e.validatePageView(testEv)).rejects.toThrow(
|
|
180
|
+
logMessages.evType
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
test('test invalid page-view - missing pageUrl', async () => {
|
|
185
|
+
const testEv = { pageTitle: 'test' } as any;
|
|
186
|
+
await expect(e.validatePageView(testEv)).rejects.toThrow(
|
|
187
|
+
logMessages.pageviewReq
|
|
188
|
+
);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
test('test invalid page-view - pageUrl set to null', async () => {
|
|
192
|
+
const testEv = { pageUrl: null } as any;
|
|
193
|
+
await expect(e.validatePageView(testEv)).rejects.toThrow(
|
|
194
|
+
logMessages.pageviewReq
|
|
195
|
+
);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
test('test valid page-view', async () => {
|
|
199
|
+
const testEv = {
|
|
200
|
+
pageUrl: 'test.test',
|
|
201
|
+
pageTitle: 'test',
|
|
202
|
+
pageReferrer: 'tested',
|
|
203
|
+
};
|
|
204
|
+
await expect(e.validatePageView(testEv)).resolves.toBe(true);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
describe('test validateTiming', () => {
|
|
209
|
+
test('test invalid timing - wrong type', async () => {
|
|
210
|
+
const testEv = undefined as any;
|
|
211
|
+
await expect(e.validateTiming(testEv)).rejects.toThrow(logMessages.evType);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test('test invalid timing - missing category', async () => {
|
|
215
|
+
const testEv = {
|
|
216
|
+
variable: 'test',
|
|
217
|
+
timing: 0,
|
|
218
|
+
} as any;
|
|
219
|
+
await expect(e.validateTiming(testEv)).rejects.toThrow(
|
|
220
|
+
logMessages.timingReq
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test('test invalid timing - missing variable', async () => {
|
|
225
|
+
const testEv = {
|
|
226
|
+
category: 'test',
|
|
227
|
+
timing: 0,
|
|
228
|
+
} as any;
|
|
229
|
+
await expect(e.validateTiming(testEv)).rejects.toThrow(
|
|
230
|
+
logMessages.timingReq
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
test('test invalid timing - missing timing', async () => {
|
|
235
|
+
const testEv = {
|
|
236
|
+
category: 'testing',
|
|
237
|
+
variable: 'test',
|
|
238
|
+
} as any;
|
|
239
|
+
await expect(e.validateTiming(testEv)).rejects.toThrow(
|
|
240
|
+
logMessages.timingReq
|
|
241
|
+
);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
test('test invalid timing - wrong category', async () => {
|
|
245
|
+
const testEv = {
|
|
246
|
+
category: null,
|
|
247
|
+
variable: 'test',
|
|
248
|
+
timing: 0,
|
|
249
|
+
} as any;
|
|
250
|
+
await expect(e.validateTiming(testEv)).rejects.toThrow(
|
|
251
|
+
logMessages.timingReq
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
test('test invalid timing - wrong variable', async () => {
|
|
256
|
+
const testEv = {
|
|
257
|
+
category: 'test',
|
|
258
|
+
variable: null,
|
|
259
|
+
timing: 0,
|
|
260
|
+
} as any;
|
|
261
|
+
await expect(e.validateTiming(testEv)).rejects.toThrow(
|
|
262
|
+
logMessages.timingReq
|
|
263
|
+
);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
test('test invalid timing - wrong timing', async () => {
|
|
267
|
+
const testEv = {
|
|
268
|
+
category: 'testing',
|
|
269
|
+
variable: 'test',
|
|
270
|
+
timing: 'invalid',
|
|
271
|
+
} as any;
|
|
272
|
+
await expect(e.validateTiming(testEv)).rejects.toThrow(
|
|
273
|
+
logMessages.timingReq
|
|
274
|
+
);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
test('test valid timing', async () => {
|
|
278
|
+
const testEv = {
|
|
279
|
+
category: 'testing',
|
|
280
|
+
variable: 'test',
|
|
281
|
+
timing: 0,
|
|
282
|
+
label: 'test',
|
|
283
|
+
};
|
|
284
|
+
await expect(e.validateTiming(testEv)).resolves.toBe(true);
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
describe('test validateConsentGranted', () => {
|
|
289
|
+
test('test invalid consentGranted - wrong type', async () => {
|
|
290
|
+
const testEv = null as any;
|
|
291
|
+
await expect(e.validateConsentGranted(testEv)).rejects.toThrow(
|
|
292
|
+
logMessages.evType
|
|
293
|
+
);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test('test invalid consentGranted - missing expiry', async () => {
|
|
297
|
+
const testEv = {
|
|
298
|
+
documentId: 'testId',
|
|
299
|
+
version: '0.0.1',
|
|
300
|
+
} as any;
|
|
301
|
+
await expect(e.validateConsentGranted(testEv)).rejects.toThrow(
|
|
302
|
+
logMessages.consentGReq
|
|
303
|
+
);
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
test('test invalid consentGranted - missing documentId', async () => {
|
|
307
|
+
const testEv = {
|
|
308
|
+
expiry: '2022-01-01T00:00:00Z',
|
|
309
|
+
version: '0.0.1',
|
|
310
|
+
} as any;
|
|
311
|
+
await expect(e.validateConsentGranted(testEv)).rejects.toThrow(
|
|
312
|
+
logMessages.consentGReq
|
|
313
|
+
);
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
test('test invalid consentGranted - missing version', async () => {
|
|
317
|
+
const testEv = {
|
|
318
|
+
expiry: '2022-01-01T00:00:00Z',
|
|
319
|
+
documentId: 'testId',
|
|
320
|
+
} as any;
|
|
321
|
+
await expect(e.validateConsentGranted(testEv)).rejects.toThrow(
|
|
322
|
+
logMessages.consentGReq
|
|
323
|
+
);
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
test('test invalid consentGranted - wrong expiry', async () => {
|
|
327
|
+
const testEv = {
|
|
328
|
+
expiry: 0,
|
|
329
|
+
documentId: 'testId',
|
|
330
|
+
version: '0.0.1',
|
|
331
|
+
} as any;
|
|
332
|
+
await expect(e.validateConsentGranted(testEv)).rejects.toThrow(
|
|
333
|
+
logMessages.consentGReq
|
|
334
|
+
);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
test('test invalid consentGranted - wrong documentId', async () => {
|
|
338
|
+
const testEv = {
|
|
339
|
+
expiry: '2022-01-01T00:00:00Z',
|
|
340
|
+
documentId: 0,
|
|
341
|
+
version: '0.0.1',
|
|
342
|
+
} as any;
|
|
343
|
+
await expect(e.validateConsentGranted(testEv)).rejects.toThrow(
|
|
344
|
+
logMessages.consentGReq
|
|
345
|
+
);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
test('test invalid consentGranted - wrong version', async () => {
|
|
349
|
+
const testEv = {
|
|
350
|
+
expiry: '2022-01-01T00:00:00Z',
|
|
351
|
+
documentId: 'testId',
|
|
352
|
+
version: undefined,
|
|
353
|
+
} as any;
|
|
354
|
+
await expect(e.validateConsentGranted(testEv)).rejects.toThrow(
|
|
355
|
+
logMessages.consentGReq
|
|
356
|
+
);
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
test('test valid consentGranted', async () => {
|
|
360
|
+
const testEv = {
|
|
361
|
+
expiry: '2022-01-01T00:00:00Z',
|
|
362
|
+
documentId: 'testId',
|
|
363
|
+
version: '0.0.1',
|
|
364
|
+
name: 'testName',
|
|
365
|
+
documentDescription: 'testDescription',
|
|
366
|
+
};
|
|
367
|
+
await expect(e.validateConsentGranted(testEv)).resolves.toBe(true);
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
describe('test validateConsentWithdrawn', () => {
|
|
372
|
+
test('test invalid consentWithdrawn - wrong type', async () => {
|
|
373
|
+
const testEv = null as any;
|
|
374
|
+
await expect(e.validateConsentWithdrawn(testEv)).rejects.toThrow(
|
|
375
|
+
logMessages.evType
|
|
376
|
+
);
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
test('test invalid consentWithdrawn - missing all', async () => {
|
|
380
|
+
const testEv = {
|
|
381
|
+
documentId: 'testId',
|
|
382
|
+
version: '0.0.1',
|
|
383
|
+
} as any;
|
|
384
|
+
await expect(e.validateConsentWithdrawn(testEv)).rejects.toThrow(
|
|
385
|
+
logMessages.consentWReq
|
|
386
|
+
);
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
test('test invalid consentWithdrawn - missing documentId', async () => {
|
|
390
|
+
const testEv = {
|
|
391
|
+
all: false,
|
|
392
|
+
version: '0.0.1',
|
|
393
|
+
} as any;
|
|
394
|
+
await expect(e.validateConsentWithdrawn(testEv)).rejects.toThrow(
|
|
395
|
+
logMessages.consentWReq
|
|
396
|
+
);
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
test('test invalid consentWithdrawn - missing version', async () => {
|
|
400
|
+
const testEv = {
|
|
401
|
+
all: true,
|
|
402
|
+
documentId: 'testId',
|
|
403
|
+
} as any;
|
|
404
|
+
await expect(e.validateConsentWithdrawn(testEv)).rejects.toThrow(
|
|
405
|
+
logMessages.consentWReq
|
|
406
|
+
);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
test('test invalid consentWithdrawn - wrong all', async () => {
|
|
410
|
+
const testEv = {
|
|
411
|
+
all: 'wrong',
|
|
412
|
+
documentId: 'testId',
|
|
413
|
+
version: '0.0.1',
|
|
414
|
+
} as any;
|
|
415
|
+
await expect(e.validateConsentWithdrawn(testEv)).rejects.toThrow(
|
|
416
|
+
logMessages.consentWReq
|
|
417
|
+
);
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
test('test invalid consentWithdrawn - wrong documentId', async () => {
|
|
421
|
+
const testEv = {
|
|
422
|
+
all: true,
|
|
423
|
+
documentId: null,
|
|
424
|
+
version: '0.0.1',
|
|
425
|
+
} as any;
|
|
426
|
+
await expect(e.validateConsentWithdrawn(testEv)).rejects.toThrow(
|
|
427
|
+
logMessages.consentWReq
|
|
428
|
+
);
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
test('test invalid consentWithdrawn - wrong version', async () => {
|
|
432
|
+
const testEv = {
|
|
433
|
+
all: true,
|
|
434
|
+
documentId: 'testId',
|
|
435
|
+
version: 0,
|
|
436
|
+
} as any;
|
|
437
|
+
await expect(e.validateConsentWithdrawn(testEv)).rejects.toThrow(
|
|
438
|
+
logMessages.consentWReq
|
|
439
|
+
);
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
test('test valid consentWithdrawn', async () => {
|
|
443
|
+
const testEv = {
|
|
444
|
+
all: true,
|
|
445
|
+
documentId: 'testId',
|
|
446
|
+
version: '0.0.1',
|
|
447
|
+
name: 'testName',
|
|
448
|
+
documentDescription: 'testDescription',
|
|
449
|
+
};
|
|
450
|
+
await expect(e.validateConsentWithdrawn(testEv)).resolves.toBe(true);
|
|
451
|
+
});
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
describe('test validateDeepLinkReceived', () => {
|
|
455
|
+
test('test invalid deepLinkReceived - wrong type', async () => {
|
|
456
|
+
const testEv = null as any;
|
|
457
|
+
await expect(e.validateDeepLinkReceived(testEv)).rejects.toThrow(
|
|
458
|
+
logMessages.evType
|
|
459
|
+
);
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
test('test invalid deepLinkReceived - missing url', async () => {
|
|
463
|
+
const testEv = {} as any;
|
|
464
|
+
await expect(e.validateDeepLinkReceived(testEv)).rejects.toThrow(
|
|
465
|
+
logMessages.deepLinkReq
|
|
466
|
+
);
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
test('test invalid deepLinkReceived - invalid url', async () => {
|
|
470
|
+
const testEv = {
|
|
471
|
+
url: true,
|
|
472
|
+
} as any;
|
|
473
|
+
await expect(e.validateDeepLinkReceived(testEv)).rejects.toThrow(
|
|
474
|
+
logMessages.deepLinkReq
|
|
475
|
+
);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
test('test valid deepLinkReceived', async () => {
|
|
479
|
+
const testEv = {
|
|
480
|
+
url: 'https://example.com/to',
|
|
481
|
+
referrer: 'https://example.com/from',
|
|
482
|
+
};
|
|
483
|
+
await expect(e.validateDeepLinkReceived(testEv)).resolves.toBe(true);
|
|
484
|
+
});
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
describe('test validateMessageNotification', () => {
|
|
488
|
+
test('test invalid messageNotification - wrong type', async () => {
|
|
489
|
+
const testEv = null as any;
|
|
490
|
+
await expect(e.validateMessageNotification(testEv)).rejects.toThrow(
|
|
491
|
+
logMessages.evType
|
|
492
|
+
);
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
test('test invalid messageNotification - missing properties', async () => {
|
|
496
|
+
const testEv = {} as any;
|
|
497
|
+
await expect(e.validateMessageNotification(testEv)).rejects.toThrow(
|
|
498
|
+
logMessages.messageNotificationReq
|
|
499
|
+
);
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
test('test invalid messageNotification - invalid trigger', async () => {
|
|
503
|
+
const testEv = {
|
|
504
|
+
title: 'x',
|
|
505
|
+
body: 'y',
|
|
506
|
+
trigger: 'z',
|
|
507
|
+
} as any;
|
|
508
|
+
await expect(e.validateMessageNotification(testEv)).rejects.toThrow(
|
|
509
|
+
logMessages.messageNotificationReq
|
|
510
|
+
);
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
test('test valid messageNotification', async () => {
|
|
514
|
+
const testEv = {
|
|
515
|
+
title: 'x',
|
|
516
|
+
body: 'y',
|
|
517
|
+
trigger: 'push',
|
|
518
|
+
} as any;
|
|
519
|
+
await expect(e.validateMessageNotification(testEv)).resolves.toBe(true);
|
|
520
|
+
});
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
describe('test isValidEcomItem', () => {
|
|
524
|
+
test('invalid - wrong type', () => {
|
|
525
|
+
const testItem = 'invalid' as any;
|
|
526
|
+
expect(e.isValidEcomItem(testItem)).toBe(false);
|
|
527
|
+
});
|
|
528
|
+
test('invalid - missing sku', () => {
|
|
529
|
+
const testItem = {
|
|
530
|
+
price: 0.1,
|
|
531
|
+
quantity: 1,
|
|
532
|
+
} as any;
|
|
533
|
+
expect(e.isValidEcomItem(testItem)).toBe(false);
|
|
534
|
+
});
|
|
535
|
+
test('invalid - missing price', () => {
|
|
536
|
+
const testItem = {
|
|
537
|
+
sku: '123',
|
|
538
|
+
quantity: 1,
|
|
539
|
+
} as any;
|
|
540
|
+
expect(e.isValidEcomItem(testItem)).toBe(false);
|
|
541
|
+
});
|
|
542
|
+
test('invalid - missing quantity', () => {
|
|
543
|
+
const testItem = {
|
|
544
|
+
sku: '123',
|
|
545
|
+
price: 0.1,
|
|
546
|
+
} as any;
|
|
547
|
+
expect(e.isValidEcomItem(testItem)).toBe(false);
|
|
548
|
+
});
|
|
549
|
+
test('invalid - wrong sku', () => {
|
|
550
|
+
const testItem = {
|
|
551
|
+
sku: 123,
|
|
552
|
+
price: 0.1,
|
|
553
|
+
quantity: 1,
|
|
554
|
+
} as any;
|
|
555
|
+
expect(e.isValidEcomItem(testItem)).toBe(false);
|
|
556
|
+
});
|
|
557
|
+
test('invalid - wrong price', () => {
|
|
558
|
+
const testItem = {
|
|
559
|
+
sku: '123',
|
|
560
|
+
price: '0.1',
|
|
561
|
+
quantity: 1,
|
|
562
|
+
} as any;
|
|
563
|
+
expect(e.isValidEcomItem(testItem)).toBe(false);
|
|
564
|
+
});
|
|
565
|
+
test('invalid - wrong quantity', () => {
|
|
566
|
+
const testItem = {
|
|
567
|
+
sku: '123',
|
|
568
|
+
price: 0.1,
|
|
569
|
+
quantity: '1',
|
|
570
|
+
} as any;
|
|
571
|
+
expect(e.isValidEcomItem(testItem)).toBe(false);
|
|
572
|
+
});
|
|
573
|
+
test('valid', () => {
|
|
574
|
+
const testItem = {
|
|
575
|
+
sku: '123',
|
|
576
|
+
price: 0.1,
|
|
577
|
+
quantity: 1,
|
|
578
|
+
};
|
|
579
|
+
expect(e.isValidEcomItem(testItem)).toBe(true);
|
|
580
|
+
});
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
describe('test validItemsArg', () => {
|
|
584
|
+
test('invalid - not an array', () => {
|
|
585
|
+
const testArg = undefined as any;
|
|
586
|
+
expect(e.validItemsArg(testArg)).toBe(false);
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
test('invalid', () => {
|
|
590
|
+
const testArg = [
|
|
591
|
+
{
|
|
592
|
+
sku: '123',
|
|
593
|
+
price: 0.1,
|
|
594
|
+
quantity: 1,
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
sku: null,
|
|
598
|
+
price: 0.1,
|
|
599
|
+
quantity: 1,
|
|
600
|
+
},
|
|
601
|
+
] as any;
|
|
602
|
+
expect(e.validItemsArg(testArg)).toBe(false);
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
test('valid - empty', () => {
|
|
606
|
+
const testArg = [] as any;
|
|
607
|
+
expect(e.validItemsArg(testArg)).toBe(true);
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
test('valid', () => {
|
|
611
|
+
const testArg = [
|
|
612
|
+
{
|
|
613
|
+
sku: '123',
|
|
614
|
+
price: 0.1,
|
|
615
|
+
quantity: 1,
|
|
616
|
+
},
|
|
617
|
+
];
|
|
618
|
+
expect(e.validItemsArg(testArg)).toBe(true);
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
describe('test validateEcommerceTransaction', () => {
|
|
623
|
+
test('invalid - wrong type', async () => {
|
|
624
|
+
const testEcom = null as any;
|
|
625
|
+
await expect(e.validateEcommerceTransaction(testEcom)).rejects.toThrow(
|
|
626
|
+
logMessages.evType
|
|
627
|
+
);
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
test('invalid - missing orderId', async () => {
|
|
631
|
+
const testEcom = {
|
|
632
|
+
totalValue: 0.1,
|
|
633
|
+
items: [
|
|
634
|
+
{
|
|
635
|
+
sku: '123',
|
|
636
|
+
price: 0.1,
|
|
637
|
+
quantity: 1,
|
|
638
|
+
},
|
|
639
|
+
],
|
|
640
|
+
} as any;
|
|
641
|
+
await expect(e.validateEcommerceTransaction(testEcom)).rejects.toThrow(
|
|
642
|
+
logMessages.ecomReq
|
|
643
|
+
);
|
|
644
|
+
});
|
|
645
|
+
|
|
646
|
+
test('invalid - missing totalValue', async () => {
|
|
647
|
+
const testEcom = {
|
|
648
|
+
orderId: '123',
|
|
649
|
+
items: [
|
|
650
|
+
{
|
|
651
|
+
sku: '123',
|
|
652
|
+
price: 0.1,
|
|
653
|
+
quantity: 1,
|
|
654
|
+
},
|
|
655
|
+
],
|
|
656
|
+
} as any;
|
|
657
|
+
await expect(e.validateEcommerceTransaction(testEcom)).rejects.toThrow(
|
|
658
|
+
logMessages.ecomReq
|
|
659
|
+
);
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
test('invalid - missing items', async () => {
|
|
663
|
+
const testEcom = {
|
|
664
|
+
orderId: '123',
|
|
665
|
+
totalValue: 0.1,
|
|
666
|
+
} as any;
|
|
667
|
+
await expect(e.validateEcommerceTransaction(testEcom)).rejects.toThrow(
|
|
668
|
+
logMessages.ecomReq
|
|
669
|
+
);
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
test('invalid - wrong orderId', async () => {
|
|
673
|
+
const testEcom = {
|
|
674
|
+
orderId: 123,
|
|
675
|
+
totalValue: 0.1,
|
|
676
|
+
items: [
|
|
677
|
+
{
|
|
678
|
+
sku: '123',
|
|
679
|
+
price: 0.1,
|
|
680
|
+
quantity: 1,
|
|
681
|
+
},
|
|
682
|
+
],
|
|
683
|
+
} as any;
|
|
684
|
+
await expect(e.validateEcommerceTransaction(testEcom)).rejects.toThrow(
|
|
685
|
+
logMessages.ecomReq
|
|
686
|
+
);
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
test('invalid - wrong totalValue', async () => {
|
|
690
|
+
const testEcom = {
|
|
691
|
+
orderId: '123',
|
|
692
|
+
totalValue: '0.1',
|
|
693
|
+
items: [
|
|
694
|
+
{
|
|
695
|
+
sku: '123',
|
|
696
|
+
price: 0.1,
|
|
697
|
+
quantity: 1,
|
|
698
|
+
},
|
|
699
|
+
],
|
|
700
|
+
} as any;
|
|
701
|
+
await expect(e.validateEcommerceTransaction(testEcom)).rejects.toThrow(
|
|
702
|
+
logMessages.ecomReq
|
|
703
|
+
);
|
|
704
|
+
});
|
|
705
|
+
|
|
706
|
+
test('invalid - wrong items', async () => {
|
|
707
|
+
const testEcom = {
|
|
708
|
+
orderId: '123',
|
|
709
|
+
totalValue: 0.1,
|
|
710
|
+
items: [
|
|
711
|
+
{
|
|
712
|
+
sku: '123',
|
|
713
|
+
quantity: 1,
|
|
714
|
+
},
|
|
715
|
+
],
|
|
716
|
+
} as any;
|
|
717
|
+
await expect(e.validateEcommerceTransaction(testEcom)).rejects.toThrow(
|
|
718
|
+
logMessages.ecomReq
|
|
719
|
+
);
|
|
720
|
+
});
|
|
721
|
+
|
|
722
|
+
test('valid', async () => {
|
|
723
|
+
const testEcom = {
|
|
724
|
+
orderId: '123',
|
|
725
|
+
totalValue: 0.1,
|
|
726
|
+
items: [
|
|
727
|
+
{
|
|
728
|
+
sku: '123',
|
|
729
|
+
price: 0.1,
|
|
730
|
+
quantity: 1,
|
|
731
|
+
},
|
|
732
|
+
],
|
|
733
|
+
};
|
|
734
|
+
await expect(e.validateEcommerceTransaction(testEcom)).resolves.toBe(true);
|
|
735
|
+
});
|
|
736
|
+
});
|