Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
docs/
lib/
node_modules/
node_modules/
coverage/
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"devDependencies": {
"@commitlint/config-conventional": "^19.6.0",
"@evilmartians/lefthook": "^1.5.0",
"@react-native-community/cli": "18.0.0",
"@react-native/babel-preset": "0.79.3",
"@react-native/eslint-config": "0.79.3",
"@react-native/metro-config": "0.79.3",
Expand Down
23 changes: 23 additions & 0 deletions src/__mocks__/MockRNIterableAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,25 @@ export class MockRNIterableAPI {
});
}

static async getInboxMessages(): Promise<IterableInAppMessage[] | undefined> {
return await new Promise((resolve) => {
// Filter messages that are marked for inbox
const inboxMessages = MockRNIterableAPI.messages?.filter(msg => msg.saveToInbox) || [];
resolve(inboxMessages);
});
}

static async getHtmlInAppContentForMessage(messageId: string): Promise<unknown> {
return await new Promise((resolve) => {
// Mock HTML content for testing
const mockHtmlContent = {
edgeInsets: { top: 10, left: 20, bottom: 30, right: 40 },
html: `<div>Mock HTML content for message ${messageId}</div>`,
};
resolve(mockHtmlContent);
});
}

static setAutoDisplayPaused = jest.fn();

static async showMessage(
Expand All @@ -107,6 +126,10 @@ export class MockRNIterableAPI {

static updateSubscriptions = jest.fn();

static startSession = jest.fn();
static endSession = jest.fn();
static updateVisibleRows = jest.fn();

// set messages function is to set the messages static property
// this is for testing purposes only
static setMessages(messages: IterableInAppMessage[]): void {
Expand Down
4 changes: 2 additions & 2 deletions src/core/classes/Iterable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ export class Iterable {
// Lazy initialization to avoid circular dependency
if (!this._inAppManager) {
// Import here to avoid circular dependency at module level

/* eslint-disable @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports */
const {
IterableInAppManager,
// eslint-disable-next-line
} = require('../../inApp/classes/IterableInAppManager');
/* eslint-enable @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports */
this._inAppManager = new IterableInAppManager();
}
return this._inAppManager;
Expand Down
Loading