Files
SubMiner/src/animeui/episode-marks.test.ts
T
sudacode 0889910687 feat(anime): filter episodes and mark them watched by hand
- Add a filter box above the episode list for a number, range, or name substring, with a "N of M" counter
- Read watch marks from the immersion tracker stats and show them per episode, with a watched count in the header, refreshed on window focus
- Add a right-click menu to mark one episode or a whole catch-up span (this and everything below) watched/unwatched
- Add setWatched/getWatchState IPC plumbing so a manual mark creates the stats row for an episode that was never played
2026-08-03 02:16:22 -07:00

28 lines
1.2 KiB
TypeScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { describeMarkCount, episodesInScope } from './episode-marks';
const LIST = ['e12', 'e11', 'e10', 'e9'];
test('the one scope takes only the episode itself', () => {
assert.deepEqual(episodesInScope(LIST, 1, 'one'), ['e11']);
});
test('the below scope takes the episode and everything listed after it', () => {
assert.deepEqual(episodesInScope(LIST, 1, 'below'), ['e11', 'e10', 'e9']);
assert.deepEqual(episodesInScope(LIST, 0, 'below'), LIST);
assert.deepEqual(episodesInScope(LIST, 3, 'below'), ['e9']);
});
test('an index outside the list marks nothing', () => {
assert.deepEqual(episodesInScope(LIST, -1, 'below'), []);
assert.deepEqual(episodesInScope(LIST, 4, 'one'), []);
});
test('describeMarkCount agrees with itself about plurals and direction', () => {
assert.equal(describeMarkCount(1, true), 'Marked 1 episode watched');
assert.equal(describeMarkCount(3, true), 'Marked 3 episodes watched');
assert.equal(describeMarkCount(1, false), 'Cleared the watch mark on 1 episode');
assert.equal(describeMarkCount(12, false), 'Cleared the watch mark on 12 episodes');
});