|
1 | | -import { UnregisteredKit } from "../../src/forwarders.interfaces"; |
2 | | -import { SDKInitConfig } from "../../src/sdkRuntimeModels"; |
3 | | - |
4 | | -// export interface IMockForwarder { |
5 | | - |
6 | | -// } |
7 | | - |
8 | | -// export interface IMockForwarderConstructor { |
9 | | -// new(unregisteredKitInstance: MockForwarder): IMockForwarder; |
10 | | -// } |
| 1 | +import { KitRegistrationConfig, RegisteredKit, UnregisteredKit } from "../../src/forwarders.interfaces"; |
11 | 2 |
|
12 | 3 | export class MockForwarder { |
13 | 4 | public name: string; |
@@ -37,10 +28,10 @@ export class MockForwarder { |
37 | 28 | this.moduleId = id || 1; |
38 | 29 | } |
39 | 30 |
|
40 | | - public register = (config: SDKInitConfig): void => { |
| 31 | + public register = (config: KitRegistrationConfig): void => { |
41 | 32 | if (config.kits) { |
42 | 33 | config.kits[this.name] = { |
43 | | - constructor: this.constructor, |
| 34 | + constructor: this.constructor as () => RegisteredKit, |
44 | 35 | }; |
45 | 36 | } |
46 | 37 | } |
@@ -69,129 +60,12 @@ export class MockForwarder { |
69 | 60 | this.appName = appName; |
70 | 61 | this.settings = settings; |
71 | 62 | this.testMode = testMode; |
72 | | - // mParticle.userAttributesFilterOnInitTest = userAttributes; |
73 | | - // mParticle.userIdentitiesFilterOnInitTest = userIdentities; |
74 | 63 | }) |
75 | 64 | } |
76 | 65 |
|
77 | | -// export const MockForwarder = function(forwarderName, forwarderId) { |
78 | | - // var constructor = function() { |
79 | | - // var self = this; |
80 | | - // this.id = forwarderId || 1; |
81 | | - // this.initCalled = false; |
82 | | - // this.processCalled = false; |
83 | | - // this.setUserIdentityCalled = false; |
84 | | - // this.onUserIdentifiedCalled = false; |
85 | | - // this.setOptOutCalled = false; |
86 | | - // this.setUserAttributeCalled = false; |
87 | | - // this.reportingService = null; |
88 | | - // this.name = forwarderName || 'MockForwarder'; |
89 | | - // this.userAttributeFilters = []; |
90 | | - // this.setUserIdentityCalled = false; |
91 | | - // this.removeUserAttributeCalled = false; |
92 | | - // this.receivedEvent = null; |
93 | | - // this.isVisible = false; |
94 | | - // this.logOutCalled = false; |
95 | | - |
96 | | - // this.trackerId = null; |
97 | | - // this.userAttributes = {}; |
98 | | - // this.userIdentities = null; |
99 | | - // this.appVersion = null; |
100 | | - // this.appName = null; |
101 | | - |
102 | | - // this.logOut = function() { |
103 | | - // this.logOutCalled = true; |
104 | | - // }; |
105 | | - |
106 | | - // this.init = function( |
107 | | - // settings, |
108 | | - // reportingService, |
109 | | - // testMode, |
110 | | - // id, |
111 | | - // userAttributes, |
112 | | - // userIdentities, |
113 | | - // appVersion, |
114 | | - // appName |
115 | | - // ) { |
116 | | - // self.reportingService = reportingService; |
117 | | - // self.initCalled = true; |
118 | | - |
119 | | - // self.trackerId = id; |
120 | | - // self.userAttributes = userAttributes; |
121 | | - // mParticle.userAttributesFilterOnInitTest = userAttributes; |
122 | | - // mParticle.userIdentitiesFilterOnInitTest = userIdentities; |
123 | | - // self.userIdentities = userIdentities; |
124 | | - // self.appVersion = appVersion; |
125 | | - // self.appName = appName; |
126 | | - // self.settings = settings; |
127 | | - // self.testMode = testMode; |
128 | | - // }; |
129 | | - |
130 | | - // this.process = function(event) { |
131 | | - // self.processCalled = true; |
132 | | - // this.receivedEvent = event; |
133 | | - // self.reportingService(self, event); |
134 | | - // self.logger.verbose(event.EventName + ' sent'); |
135 | | - // }; |
136 | | - |
137 | | - // this.setUserIdentity = function(a, b) { |
138 | | - // this.userIdentities = {}; |
139 | | - // this.userIdentities[b] = a; |
140 | | - // self.setUserIdentityCalled = true; |
141 | | - // }; |
142 | | - |
143 | | - // this.settings = { |
144 | | - // PriorityValue: 1, |
145 | | - // }; |
146 | | - |
147 | | - // this.setOptOut = function() { |
148 | | - // this.setOptOutCalled = true; |
149 | | - // }; |
150 | | - |
151 | | - // this.onUserIdentified = function(user) { |
152 | | - // this.onUserIdentifiedCalled = true; |
153 | | - // this.onUserIdentifiedUser = user; |
154 | | - // }; |
155 | | - |
156 | | - // this.onIdentifyComplete = function(user) { |
157 | | - // this.onIdentifyCompleteCalled = true;gs |
158 | | - // this.onIdentifyCompleteUser = user; |
159 | | - // }; |
160 | | - |
161 | | - // this.onLoginComplete = function(user) { |
162 | | - // this.onLoginCompleteCalled = true; |
163 | | - // this.onLoginCompleteUser = user; |
164 | | - // }; |
165 | | - |
166 | | - // this.onLogoutComplete = function(user) { |
167 | | - // this.onLogoutCompleteCalled = true; |
168 | | - // this.onLogoutCompleteUser = user; |
169 | | - // }; |
170 | | - |
171 | | - // this.onModifyComplete = function(user) { |
172 | | - // this.onModifyCompleteCalled = true; |
173 | | - // this.onModifyCompleteUser = user; |
174 | | - // }; |
175 | | - |
176 | | - // this.setUserAttribute = function(key, value) { |
177 | | - // this.setUserAttributeCalled = true; |
178 | | - // this.userAttributes[key] = value; |
179 | | - // }; |
180 | | - |
181 | | - // this.removeUserAttribute = function(key) { |
182 | | - // this.removeUserAttributeCalled = true; |
183 | | - // delete this.userAttributes[key] |
184 | | - // }; |
185 | | - |
186 | | - // window[this.name + this.id] = { |
187 | | - // instance: this, |
188 | | - // }; |
189 | | - // }; |
190 | 66 | export const MockSideloadedKit = MockForwarder; |
191 | 67 |
|
192 | | -export interface IMockSideloadedKit extends MockForwarder { |
193 | | - |
194 | | -} |
| 68 | +export interface IMockSideloadedKit extends MockForwarder {} |
195 | 69 |
|
196 | 70 | export interface IMockSideloadedKitConstructor { |
197 | 71 | new(unregisteredKitInstance: UnregisteredKit): IMockSideloadedKit; |
|
0 commit comments