Skip to content

Commit c73ed8a

Browse files
committed
update interface and add test
1 parent 125769c commit c73ed8a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

__tests__/index.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ test(`it calls MixpanelReactNative initialize`, async () => {
1212
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", false, {"$lib_version": "1.3.7", "mp_lib": "react-native"});
1313
});
1414

15+
test(`it calls MixpanelReactNative initialize with optOut and superProperties`, async () => {
16+
const mixpanel = new Mixpanel("token");
17+
mixpanel.init(true, {"super": "property"})
18+
expect(NativeModules.MixpanelReactNative.initialize).toBeCalledWith("token", true, {"$lib_version": "1.3.7", "mp_lib": "react-native", "super": "property"});
19+
});
20+
1521
test(`it calls MixpanelReactNative setServerURL`, async () => {
1622
const mixpanel = await Mixpanel.init("token");
1723
mixpanel.setServerURL("https://api-eu.mixpanel.com");

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type MixpanelProperties = { [key: string]: MixpanelType };
44
export class Mixpanel {
55
constructor(token: string);
66
static init(token: string, optOutTrackingDefault?: boolean): Promise<Mixpanel>;
7-
init(optOutTrackingDefault?: boolean): Promise<void>;
7+
init(optOutTrackingDefault?: boolean, superProperties?: MixpanelProperties): Promise<void>;
88
setServerURL(serverURL: string): void;
99
setLoggingEnabled(loggingEnabled: boolean): void;
1010
setUseIpAddressForGeolocation(useIpAddressForGeolocation: boolean): void;

0 commit comments

Comments
 (0)