test: cover empty favorite author ids

This commit is contained in:
wxs
2026-07-17 12:13:59 +08:00
parent 27a4fbb1aa
commit 8ba1787177
+30
View File
@@ -53,6 +53,36 @@ describe("favorites-import", () => {
]);
});
test("excludes empty author ids while keeping valid authors in first-occurrence order", () => {
expect(
toFavoriteMarketRecords([
{
authorId: "",
authorName: "无效达人",
savedAt: "2026-07-17T00:00:00.000Z"
},
{
authorId: "author-2",
authorName: "达人B",
savedAt: "2026-07-17T00:00:01.000Z"
},
{
authorId: "author-1",
authorName: "达人A",
savedAt: "2026-07-17T00:00:02.000Z"
},
{
authorId: "author-2",
authorName: "达人B更新",
savedAt: "2026-07-17T00:00:03.000Z"
}
])
).toEqual([
{ authorId: "author-2", authorName: "达人B", status: "idle" },
{ authorId: "author-1", authorName: "达人A", status: "idle" }
]);
});
test("returns only the minimal idle market record fields", () => {
const [record] = toFavoriteMarketRecords([
{