fix tests
This commit is contained in:
@ -92,6 +92,7 @@ export const articleSavingRequestResolver = authorized<
|
||||
'author',
|
||||
'createdAt',
|
||||
'updatedAt',
|
||||
'savedAt',
|
||||
],
|
||||
relations: {
|
||||
user: true,
|
||||
|
||||
@ -64,7 +64,7 @@ export function contentRouter() {
|
||||
// generate signed url for each library item
|
||||
const data = await Promise.all(
|
||||
libraryItems.map(async (libraryItem) => {
|
||||
const filePath = `${userId}/${
|
||||
const filePath = `content/${userId}/${
|
||||
libraryItem.id
|
||||
}.${libraryItem.updatedAt.getTime()}.${format}`
|
||||
|
||||
|
||||
@ -11,7 +11,9 @@ export const saveContentDisplayReport = async (
|
||||
uid: string,
|
||||
input: ReportItemInput
|
||||
): Promise<boolean> => {
|
||||
const item = await findLibraryItemById(input.pageId, uid)
|
||||
const item = await findLibraryItemById(input.pageId, uid, {
|
||||
select: ['id', 'readableContent', 'originalContent', 'originalUrl'],
|
||||
})
|
||||
if (!item) {
|
||||
logger.info('unable to submit report, item not found', input)
|
||||
return false
|
||||
@ -53,7 +55,9 @@ export const saveAbuseReport = async (
|
||||
uid: string,
|
||||
input: ReportItemInput
|
||||
): Promise<boolean> => {
|
||||
const item = await findLibraryItemById(input.pageId, uid)
|
||||
const item = await findLibraryItemById(input.pageId, uid, {
|
||||
select: ['id'],
|
||||
})
|
||||
if (!item) {
|
||||
logger.info('unable to submit report, item not found', input)
|
||||
return false
|
||||
|
||||
@ -2345,7 +2345,11 @@ describe('Article API', () => {
|
||||
authToken
|
||||
).expect(200)
|
||||
|
||||
const item = await findLibraryItemById(articleId, user.id)
|
||||
const item = await findLibraryItemById(articleId, user.id, {
|
||||
relations: {
|
||||
labels: true,
|
||||
},
|
||||
})
|
||||
expect(item?.labels?.map((l) => l.name)).to.eql(['Favorites'])
|
||||
})
|
||||
})
|
||||
|
||||
@ -293,7 +293,11 @@ describe('Labels API', () => {
|
||||
labelId,
|
||||
}).expect(200)
|
||||
|
||||
const updatedItem = await findLibraryItemById(item.id, user.id)
|
||||
const updatedItem = await findLibraryItemById(item.id, user.id, {
|
||||
relations: {
|
||||
labels: true,
|
||||
},
|
||||
})
|
||||
expect(updatedItem?.labels).not.deep.include(toDeleteLabel)
|
||||
})
|
||||
})
|
||||
@ -545,7 +549,11 @@ describe('Labels API', () => {
|
||||
it('should update the item with the label', async () => {
|
||||
await graphqlRequest(query, authToken).expect(200)
|
||||
|
||||
const updatedItem = await findLibraryItemById(item.id, user.id)
|
||||
const updatedItem = await findLibraryItemById(item.id, user.id, {
|
||||
relations: {
|
||||
labels: true,
|
||||
},
|
||||
})
|
||||
const updatedLabel = updatedItem?.labels?.filter(
|
||||
(l) => l.id === labelId
|
||||
)?.[0]
|
||||
|
||||
Reference in New Issue
Block a user