Skip to content

Commit 4ca1832

Browse files
refactor: Migrate Instance Manager Tests to TypeScript
1 parent ec11dc8 commit 4ca1832

File tree

3 files changed

+229
-146
lines changed

3 files changed

+229
-146
lines changed

src/sdkRuntimeModels.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ import {
2929
IdentityCallback,
3030
ISDKUserAttributes,
3131
} from './identity-user-interfaces';
32-
import { IdentityType } from './types';
32+
import {
33+
CommerceEventType,
34+
EventType,
35+
IdentityType,
36+
PromotionActionType,
37+
} from './types';
3338
import IntegrationCapture from './integrationCapture';
3439
import { INativeSdkHelpers } from './nativeSdkHelpers.interfaces';
3540
import { ICookieSyncManager, IPixelConfiguration } from './cookieSyncManager.interfaces';
@@ -155,6 +160,9 @@ export interface MParticleWebSDK {
155160
addForwarder(mockForwarder: MPForwarder): void;
156161
_IntegrationCapture: IntegrationCapture;
157162
IdentityType: valueof<typeof IdentityType>;
163+
CommerceEventType: valueof<typeof CommerceEventType>;
164+
EventType: valueof<typeof EventType>;
165+
PromotionType: valueof<typeof PromotionActionType>;
158166
_Identity: IIdentity;
159167
Identity: SDKIdentityApi;
160168
Logger: SDKLoggerApi;
@@ -189,7 +197,7 @@ export interface MParticleWebSDK {
189197
getDeviceId(): string;
190198
setDeviceId(deviceId: string): void;
191199
setSessionAttribute(key: string, value: string): void;
192-
getInstance(): MParticleWebSDK; // TODO: Create a new type for MParticleWebSDKInstance
200+
getInstance(instanceName?: string): MParticleWebSDK; // TODO: Create a new type for MParticleWebSDKInstance
193201
ServerModel();
194202
upload();
195203
setLogLevel(logLevel: LogLevelType): void;
@@ -207,6 +215,7 @@ export interface MParticleWebSDK {
207215
ProductActionType: SDKProductActionType;
208216
generateHash(value: string): string;
209217
isIOS?: boolean;
218+
sessionManager: Pick<ISessionManager, 'getSession'>;
210219
}
211220

212221
// Used in cases where server requires booleans as strings

test/src/_test.index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import './config/setup';
33

44
// Import each test module
5+
import './tests-mparticle-instance-manager';
56
import './tests-identity';
67
import './tests-batchUploader';
78
import './tests-core-sdk';
@@ -23,7 +24,6 @@ import './tests-mParticleUser';
2324
import './tests-self-hosting-specific';
2425
import './tests-runtimeToBatchEventsDTO';
2526
import './tests-apiClient';
26-
import './tests-mparticle-instance-manager';
2727
import './tests-queue-public-methods';
2828
import './tests-batchUploader_3';
2929
import './tests-validators';

0 commit comments

Comments
 (0)