Skip to content

Commit 3d9e4a2

Browse files
Apply suggestions from code review
Co-authored-by: Robert Ing <rmi22186@gmail.com>
1 parent d4ed4b9 commit 3d9e4a2

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/roktManager.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,7 @@ export default class RoktManager {
432432
if (this.isReady()) {
433433
this.currentUser = this.identityService.getCurrentUser();
434434
// Process any queued selectPlacements calls that were waiting for identity
435-
if (this.messageQueue.size > 0) {
436-
this.processMessageQueue();
437-
}
435+
this.processMessageQueue();
438436
}
439437
}
440438

test/jest/roktManager.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ describe('RoktManager', () => {
659659
await expect(promise).rejects.toThrow('Test error');
660660
});
661661

662-
it('should handle methods that return values synchronously correctly after queue is cleared', async () => {
662+
it('should resolve queued promises when kit method returns a plain value (not a Promise)', async () => {
663663
const returnValue = 'test-result';
664664
kit.use = jest.fn().mockReturnValue(returnValue);
665665

@@ -2186,6 +2186,7 @@ describe('RoktManager', () => {
21862186
await selectPlacementsPromise;
21872187

21882188
// Verify selectPlacements was called after processing the queue
2189+
expect(roktManager['messageQueue'].size).toBe(0);
21892190
expect(kit.selectPlacements).toHaveBeenCalled();
21902191
});
21912192

0 commit comments

Comments
 (0)