mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #21891 from overleaf/jpa-consistent-getObjectSize-type
[object-persistor] gcs: return a number from getObjectSize GitOrigin-RevId: f3e0e3269e789b0077c82014c42a4ca63cd84b39
This commit is contained in:
@@ -1354,6 +1354,25 @@ describe('Filestore', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('getObjectSize', function () {
|
||||
it('should return a number', async function () {
|
||||
const buf = Buffer.from('hello')
|
||||
const fileId = new ObjectId().toString()
|
||||
const fileUrl = `${filestoreUrl}/project/${projectId}/file/${fileId}`
|
||||
const res = await fetch(fileUrl, {
|
||||
method: 'POST',
|
||||
body: Stream.Readable.from([buf]),
|
||||
})
|
||||
if (!res.ok) throw new Error(res.statusText)
|
||||
expect(
|
||||
await app.persistor.getObjectSize(
|
||||
Settings.filestore.stores.user_files,
|
||||
`${projectId}/${fileId}`
|
||||
)
|
||||
).to.equal(buf.byteLength)
|
||||
})
|
||||
})
|
||||
|
||||
describe('checkIfObjectExists', function () {
|
||||
it('should return false when the object does not exist', async function () {
|
||||
expect(
|
||||
|
||||
Reference in New Issue
Block a user