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:
swaitsandClaude Fable 5.2 committed 2026-11-18 10:19:32 -07:00
1 parent 468cafc6db
commit b5defb4e4f
46 files changed
+1957 -406

No files matched your search

+25 -1
View File
@@ -10,7 +10,7 @@ test('SRU wrapped record', () => {
const [r] = parseMarcXml(fx('loc-isbn-9781593278281.xml'));
assert.deepEqual(r!.lcc, [{ raw: 'QA76.73.R87 K53 2018', complete: true }]);
assert.match(r!.meta.title!, /Rust/);
assert.ok(r!.meta.authors!.some((a) => a.startsWith('Klabnik')));
assert.ok(r!.meta.authors!.some((a) => a.endsWith('Klabnik')));
assert.equal(r!.meta.year, 2018);
assert.ok(r!.lccn);
});
@@ -53,3 +53,27 @@ test('non-text records (a DVD of the book) contribute no call number', () => {
assert.equal(parseMarcXml(rec('g'))[0]!.meta.title, 'Harry Potter');
assert.equal(parseMarcXml(rec('a'))[0]!.lcc.length, 1);
});
test('authors: 100 only, dates and commas stripped, shown as Forename Surname', () => {
const xml = `<record xmlns="http://www.loc.gov/MARC21/slim">
<datafield tag="100" ind1="1" ind2=" "><subfield code="a">Herbert, Frank,</subfield><subfield code="d">1920-1986.</subfield></datafield>
<datafield tag="245" ind1="1" ind2="0"><subfield code="a">Dune /</subfield></datafield>
<datafield tag="700" ind1="1" ind2=" "><subfield code="a">Whelan, Michael,</subfield><subfield code="d">1950-</subfield></datafield></record>`;
const [r] = parseMarcXml(xml);
assert.deepEqual(r!.meta.authors, ['Frank Herbert']);
assert.deepEqual(r!.names, ['Herbert, Frank', 'Whelan, Michael']);
});
test('authors: 700 only stands in when there is no 100; dates inside $a are removed', () => {
const xml = `<record xmlns="http://www.loc.gov/MARC21/slim">
<datafield tag="245" ind1="1" ind2="0"><subfield code="a">Anthology</subfield></datafield>
<datafield tag="700" ind1="1" ind2=" "><subfield code="a">Brooks, Frederick P., 1931-</subfield></datafield>
<datafield tag="700" ind1="1" ind2=" "><subfield code="a">King, Martin Luther, Jr.,</subfield></datafield></record>`;
const [r] = parseMarcXml(xml);
assert.deepEqual(r!.meta.authors, ['Frederick P. Brooks', 'Martin Luther King Jr.']);
});
test('the Rust fixture shows a plain author name', () => {
const [r] = parseMarcXml(fx('loc-isbn-9781593278281.xml'));
assert.ok(r!.meta.authors!.every((a) => !a.includes(',') && !/\d/.test(a)), String(r!.meta.authors));
});