Skip to content

Commit e24a4b2

Browse files
refactor: Migrate Instance Manager Tests to TypeScript
1 parent 5b0113e commit e24a4b2

File tree

3 files changed

+221
-146
lines changed

3 files changed

+221
-146
lines changed

src/sdkRuntimeModels.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ import {
2828
IdentityCallback,
2929
ISDKUserAttributes,
3030
} from './identity-user-interfaces';
31-
import { IdentityType } from './types';
31+
import {
32+
CommerceEventType,
33+
EventType,
34+
IdentityType,
35+
PromotionActionType,
36+
} from './types';
3237
import IntegrationCapture from './integrationCapture';
3338
import { INativeSdkHelpers } from './nativeSdkHelpers.interfaces';
3439
import { ICookieSyncManager, IPixelConfiguration } from './cookieSyncManager.interfaces';
@@ -154,6 +159,9 @@ export interface MParticleWebSDK {
154159
addForwarder(mockForwarder: MPForwarder): void;
155160
_IntegrationCapture: IntegrationCapture;
156161
IdentityType: valueof<typeof IdentityType>;
162+
CommerceEventType: valueof<typeof CommerceEventType>;
163+
EventType: valueof<typeof EventType>;
164+
PromotionType: valueof<typeof PromotionActionType>;
157165
_Identity: IIdentity;
158166
Identity: SDKIdentityApi;
159167
Logger: SDKLoggerApi;
@@ -188,7 +196,7 @@ export interface MParticleWebSDK {
188196
getDeviceId(): string;
189197
setDeviceId(deviceId: string): void;
190198
setSessionAttribute(key: string, value: string): void;
191-
getInstance(): MParticleWebSDK; // TODO: Create a new type for MParticleWebSDKInstance
199+
getInstance(instanceName?: string): MParticleWebSDK; // TODO: Create a new type for MParticleWebSDKInstance
192200
ServerModel();
193201
upload();
194202
setLogLevel(logLevel: LogLevelType): void;
@@ -206,6 +214,7 @@ export interface MParticleWebSDK {
206214
ProductActionType: SDKProductActionType;
207215
generateHash(value: string): string;
208216
isIOS?: boolean;
217+
sessionManager: Pick<ISessionManager, 'getSession'>;
209218
}
210219

211220
// 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)