mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-16 22:26:16 -08:00
- Moving a playlist under another server id takes its parental locks along (they stay in the browser). - Bare legacy Xtream ids in each copy are typed from that copy's own snapshots before favorites, history and snapshots are combined, so a live channel and a movie sharing an id both survive. - Writes still travelling are saved on page hide too; saved writes and the cache belong to one server database (cache owner = instanceId). - A late successful answer no longer turns unauthorized back to online. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
import { combineUserData } from './server-migration-merge';
|
|
import { typeLegacyXtreamRefs } from './server-migration-xtream';
|
|
|
|
describe('typeLegacyXtreamRefs', () => {
|
|
it('types bare ids from the same copy snapshots', () => {
|
|
expect(
|
|
typeLegacyXtreamRefs({
|
|
'xtream-favorites': [42, 'movie:7', 99],
|
|
'xtream-recent-items': [{ id: 42, viewedAt: 't' }],
|
|
'xtream-collection-items': {
|
|
'42': { xtream_id: 42, type: 'live', title: 'News' },
|
|
'movie:7': { xtream_id: 7, type: 'movie' },
|
|
},
|
|
})
|
|
).toEqual({
|
|
'xtream-favorites': ['live:42', 'movie:7', 99],
|
|
'xtream-recent-items': [{ id: 'live:42', viewedAt: 't' }],
|
|
'xtream-collection-items': {
|
|
'live:42': { xtream_id: 42, type: 'live', title: 'News' },
|
|
'movie:7': { xtream_id: 7, type: 'movie' },
|
|
},
|
|
});
|
|
});
|
|
|
|
it('keeps a live and a movie favorite that share an id apart', () => {
|
|
const browser = typeLegacyXtreamRefs({
|
|
'xtream-favorites': [42],
|
|
'xtream-collection-items': {
|
|
'42': { xtream_id: 42, type: 'live' },
|
|
},
|
|
});
|
|
const server = typeLegacyXtreamRefs({
|
|
'xtream-favorites': [42],
|
|
'xtream-collection-items': {
|
|
'42': { xtream_id: 42, type: 'movie' },
|
|
},
|
|
});
|
|
|
|
expect(
|
|
combineUserData([
|
|
server['xtream-favorites'],
|
|
browser['xtream-favorites'],
|
|
])
|
|
).toEqual(['movie:42', 'live:42']);
|
|
expect(
|
|
combineUserData([
|
|
server['xtream-collection-items'],
|
|
browser['xtream-collection-items'],
|
|
])
|
|
).toEqual({
|
|
'movie:42': { xtream_id: 42, type: 'movie' },
|
|
'live:42': { xtream_id: 42, type: 'live' },
|
|
});
|
|
});
|
|
});
|