Skip to content

Commit

Permalink
refactor: Migrate Instance Manager Tests to TypeScript (#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexs-mparticle authored Nov 27, 2024
1 parent 5b0113e commit 802b639
Show file tree
Hide file tree
Showing 3 changed files with 223 additions and 146 deletions.
13 changes: 11 additions & 2 deletions src/sdkRuntimeModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ import {
IdentityCallback,
ISDKUserAttributes,
} from './identity-user-interfaces';
import { IdentityType } from './types';
import {
CommerceEventType,
EventType,
IdentityType,
PromotionActionType,
} from './types';
import IntegrationCapture from './integrationCapture';
import { INativeSdkHelpers } from './nativeSdkHelpers.interfaces';
import { ICookieSyncManager, IPixelConfiguration } from './cookieSyncManager.interfaces';
Expand Down Expand Up @@ -154,6 +159,9 @@ export interface MParticleWebSDK {
addForwarder(mockForwarder: MPForwarder): void;
_IntegrationCapture: IntegrationCapture;
IdentityType: valueof<typeof IdentityType>;
CommerceEventType: valueof<typeof CommerceEventType>;
EventType: valueof<typeof EventType>;
PromotionType: valueof<typeof PromotionActionType>;
_Identity: IIdentity;
Identity: SDKIdentityApi;
Logger: SDKLoggerApi;
Expand Down Expand Up @@ -188,7 +196,7 @@ export interface MParticleWebSDK {
getDeviceId(): string;
setDeviceId(deviceId: string): void;
setSessionAttribute(key: string, value: string): void;
getInstance(): MParticleWebSDK; // TODO: Create a new type for MParticleWebSDKInstance
getInstance(instanceName?: string): MParticleWebSDK; // https://go.mparticle.com/work/SQDSDKS-4804
ServerModel();
upload();
setLogLevel(logLevel: LogLevelType): void;
Expand All @@ -206,6 +214,7 @@ export interface MParticleWebSDK {
ProductActionType: SDKProductActionType;
generateHash(value: string): string;
isIOS?: boolean;
sessionManager: Pick<ISessionManager, 'getSession'>; // https://go.mparticle.com/work/SQDSDKS-6949
}

// Used in cases where server requires booleans as strings
Expand Down
2 changes: 1 addition & 1 deletion test/src/_test.index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import './config/setup';

// Import each test module
import './tests-mparticle-instance-manager';
import './tests-identity';
import './tests-batchUploader';
import './tests-core-sdk';
Expand All @@ -23,7 +24,6 @@ import './tests-mParticleUser';
import './tests-self-hosting-specific';
import './tests-runtimeToBatchEventsDTO';
import './tests-apiClient';
import './tests-mparticle-instance-manager';
import './tests-queue-public-methods';
import './tests-batchUploader_3';
import './tests-validators';
Expand Down
Loading

0 comments on commit 802b639

Please sign in to comment.