Rework scan screen, make lookups non-blocking, fix review findings
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
468cafc6db
commit
b5defb4e4f
46 files changed
+1957
-406
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { emptySession, forget, touch } from './session.ts';
|
||||
|
||||
test('a book listed twice stays one row and moves to the top', () => {
|
||||
let s = touch(emptySession, 1, false);
|
||||
s = touch(s, 2, false);
|
||||
s = touch(s, 1, true);
|
||||
assert.deepEqual(s.order, [1, 2]);
|
||||
assert.equal(s.touched[1], 2);
|
||||
assert.equal(s.touched[2], 1);
|
||||
});
|
||||
|
||||
test('"earlier" is decided when the book is first listed, not by later scans', () => {
|
||||
let s = touch(emptySession, 1, false);
|
||||
s = touch(s, 1, true);
|
||||
assert.equal(s.earlier[1], undefined);
|
||||
s = touch(s, 2, true);
|
||||
s = touch(s, 2, false);
|
||||
assert.equal(s.earlier[2], true);
|
||||
});
|
||||
|
||||
test('forget removes a book everywhere', () => {
|
||||
let s = touch(touch(emptySession, 1, true), 2, false);
|
||||
s = forget(s, 1);
|
||||
assert.deepEqual(s.order, [2]);
|
||||
assert.equal(s.earlier[1], undefined);
|
||||
assert.equal(s.touched[1], undefined);
|
||||
});
|
||||
Reference in new issue
Block a user