Skip to content

Commit d79f08d

Browse files
committed
test: update IterableEmbeddedManager.test.ts as per pr suggestion
1 parent 1389b80 commit d79f08d

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

src/embedded/classes/IterableEmbeddedManager.test.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,17 +673,33 @@ describe('IterableEmbeddedManager', () => {
673673
expect(manager.isEnabled).toBe(false);
674674
});
675675

676-
it('should keep isEnabled false when constructed with enableEmbeddedMessaging === false and not call native sync', () => {
676+
it('constructor with enableEmbeddedMessaging === false does not auto-call native sync', () => {
677677
// GIVEN a config with enableEmbeddedMessaging explicitly false
678678
const configWithFalse = new IterableConfig();
679679
configWithFalse.enableEmbeddedMessaging = false;
680+
681+
// WHEN creating a new embedded manager
680682
const manager = new IterableEmbeddedManager(configWithFalse);
681683

684+
// THEN isEnabled is false and the constructor did not auto-call native sync
685+
// (the branch on line 57 is evaluated at construction time)
686+
expect(manager.isEnabled).toBe(false);
687+
expect(MockRNIterableAPI.syncEmbeddedMessages).not.toHaveBeenCalled();
688+
});
689+
690+
it('explicit syncMessages still proxies through to native when enableEmbeddedMessaging === false', () => {
691+
// GIVEN a config with enableEmbeddedMessaging explicitly false
692+
const configWithFalse = new IterableConfig();
693+
configWithFalse.enableEmbeddedMessaging = false;
694+
const manager = new IterableEmbeddedManager(configWithFalse);
695+
696+
// sanity: constructor did not auto-call native sync
697+
expect(MockRNIterableAPI.syncEmbeddedMessages).not.toHaveBeenCalled();
698+
682699
// WHEN syncMessages is called on a disabled manager
683700
manager.syncMessages();
684701

685702
// THEN isEnabled remains false and the underlying sync still proxies through
686-
// (the branch on line 57 has already been evaluated at construction time)
687703
expect(manager.isEnabled).toBe(false);
688704
expect(MockRNIterableAPI.syncEmbeddedMessages).toHaveBeenCalledTimes(1);
689705
});

0 commit comments

Comments
 (0)