From 5e4ad097e3dae5304f1bac23bc7107a1338478d4 Mon Sep 17 00:00:00 2001 From: 4gray Date: Sun, 27 Sep 2026 14:23:38 +0200 Subject: [PATCH] test(stalker): cover page-one rows leaving the screen on relock while the reload hangs Co-Authored-By: Claude Opus 5.5 --- .../with-stalker-content.feature.spec.ts | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/libs/portal/stalker/data-access/src/lib/stores/features/with-stalker-content.feature.spec.ts b/libs/portal/stalker/data-access/src/lib/stores/features/with-stalker-content.feature.spec.ts index 514d69a06..78ada9b2e 100644 --- a/libs/portal/stalker/data-access/src/lib/stores/features/with-stalker-content.feature.spec.ts +++ b/libs/portal/stalker/data-access/src/lib/stores/features/with-stalker-content.feature.spec.ts @@ -707,6 +707,43 @@ describe('withStalkerContent failure states', () => { expect(store.totalCount()).toBe(2); }); + it('takes page-one rows of a newly locked genre off screen before the reload answers', async () => { + let hangReload = false; + dataService.sendIpcEvent.mockImplementation(() => + hangReload + ? new Promise(() => undefined) + : Promise.resolve({ + js: { + data: [ + { id: 'movie-1', name: 'One', category_id: '5' }, + { id: 'adult-1', name: 'A', category_id: '9' }, + ], + total_items: 2, + }, + }) + ); + store.setSelectedContentType('vod'); + store.setCategories('vod', [ + { category_id: '5', category_name: 'Action' }, + { category_id: '9', category_name: 'Adult' }, + ]); + store.setSelectedCategory('*'); + store.setCurrentPlaylist(PLAYLIST); + void store.isPaginatedContentLoading(); + await waitForCondition(() => store.getPaginatedContent().length === 2); + + // Lock now while the replacement request hangs. + hangReload = true; + parentalLock.active.mockReturnValue(true); + parentalLock.lockedStalkerIds.mockReturnValue(['9']); + parentalLock.version.set(1); + + // Page 1 blanks the grid synchronously before its request, so the + // locked row is gone even though the reload never answers. + await waitForCondition(() => store.getPaginatedContent().length === 0); + expect(dataService.sendIpcEvent).toHaveBeenCalledTimes(2); + }); + it('keeps accumulated pages when an append fails and retries the same page', async () => { let failPageTwo = true; dataService.sendIpcEvent.mockImplementation(