@@ -58,6 +58,7 @@ const {
|
||||
anchorsFromHTML,
|
||||
statusOf,
|
||||
kindOf,
|
||||
finishedLabel,
|
||||
} = require("../manga-bookmark.user.js");
|
||||
|
||||
// detect() reads only these four properties off location.
|
||||
@@ -397,6 +398,18 @@ test("statusOf defaults a missing status to reading", () => {
|
||||
assert.equal(statusOf({ status: "archived" }), "archived");
|
||||
});
|
||||
|
||||
// ============================================================
|
||||
// finishedLabel — finished is a fact about the Series (issue #157), which is
|
||||
// the server's business; the panel only names it. The label is text through
|
||||
// the el() helper, never markup.
|
||||
// ============================================================
|
||||
|
||||
test("finishedLabel names a finished series and nothing else", () => {
|
||||
assert.equal(finishedLabel({ finished: true }), "Finished");
|
||||
assert.equal(finishedLabel({ finished: false }), "");
|
||||
assert.equal(finishedLabel({}), "");
|
||||
});
|
||||
|
||||
// ============================================================
|
||||
// kindOf — a row written before the kind column existed has none, and every
|
||||
// one of those is manga.
|
||||
|
||||
@@ -49,6 +49,7 @@ const {
|
||||
kindOf,
|
||||
maxChapter,
|
||||
repairLnwStaleRow,
|
||||
finishedLabel,
|
||||
} = require("../novel-bookmark.user.js");
|
||||
|
||||
function loc(href) {
|
||||
@@ -563,6 +564,23 @@ test("repairLnwStaleRow does not regress progress when the repaired-key row is a
|
||||
assert.equal(out.list[0].last_chapter_num, 100);
|
||||
});
|
||||
|
||||
// ============================================================
|
||||
// Merge rank — exactly two values: archived beats reading, and nothing else
|
||||
// can ever win (issue #157 retired the finished bucket).
|
||||
// ============================================================
|
||||
|
||||
test("repairLnwStaleRow merge keeps archived over reading and lets no third value win", () => {
|
||||
const canonical = (over) => staleRow(Object.assign({ key: "lightnovelworld:immortality-simulator" }, over));
|
||||
// archived beats reading whether it arrives as the stale row or the repaired one
|
||||
let out = repairLnwStaleRow([canonical({ status: "archived" }), staleRow({ status: "reading" })], [], {}, lnwPage());
|
||||
assert.equal(out.list[0].status, "archived");
|
||||
out = repairLnwStaleRow([staleRow({ status: "archived" }), canonical({ status: "reading" })], [], {}, lnwPage());
|
||||
assert.equal(out.list[0].status, "archived");
|
||||
// "finished" is not a bucket anymore: a row carrying it reads as the
|
||||
// default, so it can never win (issue #157).
|
||||
out = repairLnwStaleRow([staleRow({ status: "finished" }), canonical({ status: "reading" })], [], {}, lnwPage());
|
||||
assert.equal(out.list[0].status, "reading");
|
||||
});
|
||||
// ============================================================
|
||||
// kindOf
|
||||
// ============================================================
|
||||
@@ -575,6 +593,18 @@ test("kindOf passes through novel", () => {
|
||||
assert.equal(kindOf({ kind: "novel" }), "novel");
|
||||
});
|
||||
|
||||
// ============================================================
|
||||
// finishedLabel — finished is a fact about the Series (issue #157), which is
|
||||
// the server's business; the panel only names it. The label is text through
|
||||
// the el() helper, never markup.
|
||||
// ============================================================
|
||||
|
||||
test("finishedLabel names a finished series and nothing else", () => {
|
||||
assert.equal(finishedLabel({ finished: true }), "Finished");
|
||||
assert.equal(finishedLabel({ finished: false }), "");
|
||||
assert.equal(finishedLabel({}), "");
|
||||
});
|
||||
|
||||
// ============================================================
|
||||
// Source guard
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user