From 5e4decbe967ec28f9263bcb1d9907ee86262b91e Mon Sep 17 00:00:00 2001 From: kamtschatka Date: Sat, 27 Jul 2024 22:32:37 +0200 Subject: feature(cli): Allow updating tags/lists from CLI (#211) * Improve the CLI #209 added the possibility to assign tags to bookmarks while creating added the possibility to assign a newly created to a list right away added the possibility to add and remove tags from bookmarks * minor tweaks --------- Co-authored-by: MohamedBassem --- packages/trpc/routers/bookmarks.test.ts | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'packages/trpc/routers/bookmarks.test.ts') diff --git a/packages/trpc/routers/bookmarks.test.ts b/packages/trpc/routers/bookmarks.test.ts index 67e73ad1..802bd992 100644 --- a/packages/trpc/routers/bookmarks.test.ts +++ b/packages/trpc/routers/bookmarks.test.ts @@ -126,23 +126,37 @@ describe("Bookmark Routes", () => { await api.updateTags({ bookmarkId: createdBookmark.id, - attach: [{ tagName: "tag1" }, { tagName: "tag2" }], + attach: [ + { tagName: "tag1" }, + { tagName: "tag2" }, + { tagName: "tag3" }, + { tagName: "tag4" }, + ], detach: [], }); let bookmark = await api.getBookmark({ bookmarkId: createdBookmark.id }); - expect(bookmark.tags.map((t) => t.name).sort()).toEqual(["tag1", "tag2"]); + expect(bookmark.tags.map((t) => t.name).sort()).toEqual([ + "tag1", + "tag2", + "tag3", + "tag4", + ]); const tag1Id = bookmark.tags.filter((t) => t.name == "tag1")[0].id; await api.updateTags({ bookmarkId: bookmark.id, - attach: [{ tagName: "tag3" }], - detach: [{ tagId: tag1Id }], + attach: [{ tagName: "tag5" }], + detach: [{ tagId: tag1Id }, { tagName: "tag4" }], }); bookmark = await api.getBookmark({ bookmarkId: bookmark.id }); - expect(bookmark.tags.map((t) => t.name).sort()).toEqual(["tag2", "tag3"]); + expect(bookmark.tags.map((t) => t.name).sort()).toEqual([ + "tag2", + "tag3", + "tag5", + ]); await api.updateTags({ bookmarkId: bookmark.id, -- cgit v1.2.3-70-g09d2