revert soft deletes all the labels and highlights attached to the deleted item

This commit is contained in:
Hongbo Wu
2024-01-17 10:04:22 +08:00
parent 38ee6c1331
commit abfa15e56f
2 changed files with 2 additions and 32 deletions

View File

@ -711,39 +711,18 @@ describe('Article API', () => {
}
const item = await createOrUpdateLibraryItem(itemToSave, user.id)
itemId = item.id
await createAndSaveLabelsInLibraryItem(itemId, user.id, [
{
name: 'test label 2',
},
])
await createHighlight(
{
shortId: generateFakeShortId(),
user: { id: user.id },
quote: 'test quote 2',
},
itemId,
user.id
)
})
after(async () => {
await deleteLibraryItemById(itemId, user.id)
})
it('marks an item as deleted and deletes all the labels and highlights attached to the item', async () => {
it('soft deletes the item', async () => {
await graphqlRequest(setBookmarkQuery(itemId, false), authToken).expect(
200
)
const item = await findLibraryItemById(itemId, user.id)
expect(item?.state).to.eql(LibraryItemState.Deleted)
const labels = await findLabelsByLibraryItemId(itemId, user.id)
expect(labels).to.be.empty
const highlights = await findHighlightsByLibraryItemId(itemId, user.id)
expect(highlights).to.be.empty
})
})