feat: 分类显示书籍数量并发布 v2.1.2
构建与发布 / 单测与集成测试 (push) Waiting to run
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, linux, ubuntu-24.04-arm) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (arm64, macos, macos-15) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, linux, ubuntu-24.04) (push) Blocked by required conditions
构建与发布 / 打包 ${{ matrix.platform }} ${{ matrix.arch }} (x64, windows, windows-2025) (push) Blocked by required conditions
构建与发布 / 发布 GitHub Release (push) Blocked by required conditions

This commit is contained in:
lofyer
2026-08-06 18:27:47 +08:00
parent eaf9939436
commit d6078098d6
12 changed files with 91 additions and 19 deletions
+19
View File
@@ -613,6 +613,25 @@ test('书架 CRUD 强制唯一非空名称并返回深拷贝', () => {
assert.throws(() => store.updateShelf(other.id, { name: ' 文学 ' }), /已存在/);
});
test('书架列表返回每个分类当前包含的书籍数量', () => {
freshRoot('shelf-counts');
const research = store.addShelf('研究');
const archive = store.addShelf('归档');
const first = store.add({ title: 'A', shelfId: research.id });
store.add({ title: 'B', shelfId: research.id });
store.add({ title: '未分类' });
assert.deepStrictEqual(
store.listShelves().map((shelf) => [shelf.name, shelf.count]),
[['研究', 2], ['归档', 0]]
);
store.update(first.id, { shelfId: archive.id });
assert.deepStrictEqual(
store.listShelves().map((shelf) => [shelf.name, shelf.count]),
[['研究', 1], ['归档', 1]]
);
});
test('删除书架只清空条目 shelfId 且组织变更触发通知', () => {
freshRoot('shelf-remove');
let changes = 0;