Skip to content

Commit 8f2bd91

Browse files
committed
test(SDK-518): increase unit test coverage on core SDK surface
- Replace placeholder root test with public surface export checks - Add event-handler wiring/dedup and platform URL-handler tests for Iterable.ts - Add bridge proxy tests for initialization and embedded messaging in IterableApi.ts - Add auth handler tests for string/null/undefined/timeout resolution paths - Raise Jest coverage thresholds for core touched files
1 parent ab9c8bb commit 8f2bd91

5 files changed

Lines changed: 601 additions & 6 deletions

File tree

jest.config.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,28 @@ module.exports = {
2020
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
2121
coverageThreshold: {
2222
global: {
23-
branches: 10,
24-
functions: 30,
25-
lines: 30,
26-
statements: 30,
23+
branches: 53,
24+
functions: 47,
25+
lines: 58,
26+
statements: 58,
27+
},
28+
'src/core/classes/Iterable.ts': {
29+
statements: 90,
30+
branches: 85,
31+
functions: 95,
32+
lines: 90,
33+
},
34+
'src/core/classes/IterableApi.ts': {
35+
statements: 95,
36+
branches: 70,
37+
functions: 95,
38+
lines: 95,
39+
},
40+
'src/core/classes/IterableConfig.ts': {
41+
statements: 95,
42+
branches: 90,
43+
functions: 90,
44+
lines: 95,
2745
},
2846
},
2947
};

src/__tests__/index.test.tsx

Lines changed: 97 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,98 @@
1-
describe('index', () => {
2-
it.todo('write a test');
1+
import {
2+
Iterable,
3+
IterableAction,
4+
IterableActionContext,
5+
IterableActionSource,
6+
IterableAttributionInfo,
7+
IterableAuthFailureReason,
8+
IterableAuthResponse,
9+
IterableAuthResponseResult,
10+
IterableCommerceItem,
11+
IterableConfig,
12+
IterableDataRegion,
13+
IterableEdgeInsets,
14+
IterableEmbeddedManager,
15+
IterableEmbeddedView,
16+
IterableEmbeddedViewType,
17+
IterableHtmlInAppContent,
18+
IterableInAppCloseSource,
19+
IterableInAppContentType,
20+
IterableInAppDeleteSource,
21+
IterableInAppLocation,
22+
IterableInAppManager,
23+
IterableInAppMessage,
24+
IterableInAppShowResponse,
25+
IterableInAppTrigger,
26+
IterableInAppTriggerType,
27+
IterableInbox,
28+
IterableInboxDataModel,
29+
IterableInboxEmptyState,
30+
IterableInboxMessageCell,
31+
IterableInboxMetadata,
32+
IterableLogLevel,
33+
IterableLogger,
34+
IterablePushPlatform,
35+
IterableRetryBackoff,
36+
useAppStateListener,
37+
useDeviceOrientation,
38+
} from '../index';
39+
40+
describe('public SDK surface', () => {
41+
it('exports the static facade', () => {
42+
expect(Iterable).toBeDefined();
43+
expect(typeof Iterable.initialize).toBe('function');
44+
});
45+
46+
it('exports core model classes', () => {
47+
expect(IterableAction).toBeDefined();
48+
expect(IterableActionContext).toBeDefined();
49+
expect(IterableAttributionInfo).toBeDefined();
50+
expect(IterableAuthResponse).toBeDefined();
51+
expect(IterableCommerceItem).toBeDefined();
52+
expect(IterableConfig).toBeDefined();
53+
expect(IterableEdgeInsets).toBeDefined();
54+
expect(IterableLogger).toBeDefined();
55+
});
56+
57+
it('exports core enums', () => {
58+
expect(IterableActionSource).toBeDefined();
59+
expect(IterableAuthFailureReason).toBeDefined();
60+
expect(IterableAuthResponseResult).toBeDefined();
61+
expect(IterableDataRegion).toBeDefined();
62+
expect(IterableLogLevel).toBeDefined();
63+
expect(IterablePushPlatform).toBeDefined();
64+
expect(IterableRetryBackoff).toBeDefined();
65+
});
66+
67+
it('exports in-app model classes and enums', () => {
68+
expect(IterableHtmlInAppContent).toBeDefined();
69+
expect(IterableInAppManager).toBeDefined();
70+
expect(IterableInAppMessage).toBeDefined();
71+
expect(IterableInAppTrigger).toBeDefined();
72+
expect(IterableInboxMetadata).toBeDefined();
73+
expect(IterableInAppCloseSource).toBeDefined();
74+
expect(IterableInAppContentType).toBeDefined();
75+
expect(IterableInAppDeleteSource).toBeDefined();
76+
expect(IterableInAppLocation).toBeDefined();
77+
expect(IterableInAppShowResponse).toBeDefined();
78+
expect(IterableInAppTriggerType).toBeDefined();
79+
});
80+
81+
it('exports inbox components and types', () => {
82+
expect(IterableInbox).toBeDefined();
83+
expect(IterableInboxDataModel).toBeDefined();
84+
expect(IterableInboxEmptyState).toBeDefined();
85+
expect(IterableInboxMessageCell).toBeDefined();
86+
});
87+
88+
it('exports embedded messaging surface', () => {
89+
expect(IterableEmbeddedManager).toBeDefined();
90+
expect(IterableEmbeddedView).toBeDefined();
91+
expect(IterableEmbeddedViewType).toBeDefined();
92+
});
93+
94+
it('exports hooks', () => {
95+
expect(useAppStateListener).toBeDefined();
96+
expect(useDeviceOrientation).toBeDefined();
97+
});
398
});

0 commit comments

Comments
 (0)