Skip to content

Commit f37fd3e

Browse files
committed
feat: test setOverAirVersion
1 parent d42d927 commit f37fd3e

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/mocks/mockInstabug.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const mockInstabug: InstabugNativeModule = {
1414
setEnabled: jest.fn(),
1515
init: jest.fn(),
1616
setCodePushVersion: jest.fn(),
17+
setOverAirVersion: jest.fn(),
1718
setUserData: jest.fn(),
1819
setTrackUserSteps: jest.fn(),
1920
setIBGLogPrintsToConsole: jest.fn(),

test/modules/Instabug.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
Locale,
1818
LogLevel,
1919
NetworkInterceptionMode,
20+
OverAirUpdateServices,
2021
ReproStepsMode,
2122
StringKey,
2223
WelcomeMessageMode,
@@ -281,6 +282,10 @@ describe('Instabug Module', () => {
281282
invocationEvents: [InvocationEvent.floatingButton, InvocationEvent.shake],
282283
debugLogsLevel: LogLevel.debug,
283284
codePushVersion: '1.1.0',
285+
overAirVersion: {
286+
service: OverAirUpdateServices.expo,
287+
version: 'D0A12345-6789-4B3C-A123-4567ABCDEF01',
288+
},
284289
};
285290
const usesNativeNetworkInterception = false;
286291

@@ -294,6 +299,7 @@ describe('Instabug Module', () => {
294299
instabugConfig.debugLogsLevel,
295300
usesNativeNetworkInterception,
296301
instabugConfig.codePushVersion,
302+
instabugConfig.overAirVersion,
297303
);
298304
});
299305

@@ -306,13 +312,29 @@ describe('Instabug Module', () => {
306312
expect(NativeInstabug.setCodePushVersion).toBeCalledWith(codePushVersion);
307313
});
308314

315+
it('setOverAirVersion should call native method setOverAirVersion', () => {
316+
const OTAversion = {
317+
service: OverAirUpdateServices.expo,
318+
version: 'D0A12345-6789-4B3C-A123-4567ABCDEF01',
319+
};
320+
321+
Instabug.setOverAirVersion(OTAversion);
322+
323+
expect(NativeInstabug.setOverAirVersion).toBeCalledTimes(1);
324+
expect(NativeInstabug.setOverAirVersion).toBeCalledWith(OTAversion);
325+
});
326+
309327
it('init should disable JavaScript interceptor when using native interception mode', () => {
310328
const instabugConfig = {
311329
token: 'some-token',
312330
invocationEvents: [InvocationEvent.floatingButton, InvocationEvent.shake],
313331
debugLogsLevel: LogLevel.debug,
314332
networkInterceptionMode: NetworkInterceptionMode.native,
315333
codePushVersion: '1.1.0',
334+
overAirVersion: {
335+
service: OverAirUpdateServices.expo,
336+
version: 'D0A12345-6789-4B3C-A123-4567ABCDEF01',
337+
},
316338
};
317339

318340
Instabug.init(instabugConfig);
@@ -326,6 +348,7 @@ describe('Instabug Module', () => {
326348
// usesNativeNetworkInterception should be true when using native interception mode
327349
true,
328350
instabugConfig.codePushVersion,
351+
instabugConfig.overAirVersion,
329352
);
330353
});
331354

0 commit comments

Comments
 (0)