Add an uploadFileTest to verify GCS URLs are used for file:// objects

This commit is contained in:
Jackson Harper 2022-06-09 12:25:58 -07:00
parent 98bc1470b5
commit 70d655f591
2 changed files with 9 additions and 2 deletions

View file

@ -22,7 +22,7 @@ public struct PDFItem {
objectID: item.objectID,
itemID: item.unwrappedID,
pdfURL: URL(string: item.unwrappedPageURLString),
localPdfURL: item.localPdfURL.flatMap { URL(string: $0) },
localPdfURL: nil, // item.localPdfURL.flatMap { URL(string: $0) },
title: item.unwrappedID,
slug: item.unwrappedSlug,
readingProgress: item.readingProgress,

View file

@ -89,11 +89,18 @@ describe('uploadFileRequest API', () => {
})
it('should create an article if create article is true', async () => {
const res = uploadFileRequest(authToken, 'https://www.google.com', clientRequestId, true).expect(200)
const res = await uploadFileRequest(authToken, 'https://www.google.com', clientRequestId, true)
expect(res.body.data.uploadFileRequest.createdPageId).to.eql(clientRequestId)
const page = await getPageById(clientRequestId)
expect(page).to.be
})
it('should not save a file:// URL', async () => {
const res = await uploadFileRequest(authToken, 'file://foo.bar', clientRequestId, true)
expect(res.body.data.uploadFileRequest.createdPageId).to.eql(clientRequestId)
const page = await getPageById(clientRequestId)
expect(page.url).to.startWith("https://")
})
})
})
})