test(stalker): distinguish paged All Items from the initial cache grid

This commit is contained in:
4gray committed 2026-09-06 08:14:34 +02:00
1 parent 7166c1e594
commit 08415139c5
2 files changed
+36

No files matched your search

@@ -760,6 +760,15 @@ describe('withStalkerContent full ITV channel list cache', () => {
void store.isPaginatedContentLoading();
}
it('does not request paged channels without a selected category', async () => {
setup(null);
enterItvCategory('');
await flushResources();
expect(store.itvChannels()).toEqual([]);
expect(store.hasMoreChannels()).toBe(false);
expect(dataService.sendIpcEvent).not.toHaveBeenCalled();
});
it('serves the whole category from the cache without portal requests', async () => {
setup(CACHED_CHANNELS);
enterItvCategory('5');
@@ -100,6 +100,7 @@ describe('StalkerLiveStreamLayoutComponent fullscreen panel search', () => {
store.selectedContentType.set('itv');
store.radioChannels.set([]);
store.itvFullChannelList.set([]);
store.itvFullListLoading.set(false);
store.setPage.mockClear();
await TestBed.configureTestingModule({
imports: [
@@ -205,6 +206,32 @@ describe('StalkerLiveStreamLayoutComponent fullscreen panel search', () => {
expect(component.channelsForList(panelTerm)).toHaveLength(100);
});
it('searches paged All Items while the full cache is still loading', () => {
store.selectedCategoryId.set('*');
store.itvFullListLoading.set(true);
searchPhrase.set('one');
fixture.detectChanges();
expect(component.showItvAllItems()).toBe(false);
expect(component.filteredChannels()).toEqual([channels[0]]);
expect(component.channelsForList(signal('two'))).toEqual([channels[1]]);
});
it('does not relabel retained category rows as the initial All Items grid', () => {
// No selected category has no provider-page request. The unselected
// grid waits for the public cache, even if a prior category's rows
// are still present before the store's reset effect settles.
store.selectedCategoryId.set(null);
store.itvFullListLoading.set(true);
searchPhrase.set('one');
fixture.detectChanges();
expect(component.showItvAllItems()).toBe(true);
expect(component.filteredChannels()).toEqual([]);
expect(component.channelsForList(signal('two'))).toEqual([]);
store.itvFullChannelList.set(channels);
expect(component.filteredChannels()).toEqual([channels[0]]);
expect(component.channelsForList(signal('two'))).toEqual([channels[1]]);
});
it('does not search the ITV cache after switching to radio', () => {
itvFullListActive.set(true);
store.itvFullChannelList.set(channels);