Merge pull request #22239 from overleaf/jpa-file-url-helper
[web] add helper for getting file URL from history w/ filestore fallback GitOrigin-RevId: d77e6f1565fab407e1004a02c4bfdfe03a0214d7
This commit is contained in:
@@ -116,6 +116,59 @@ describe('TpdsUpdateSender', function () {
|
||||
})
|
||||
|
||||
it('queues a post the file with user and file id', async function () {
|
||||
const fileId = '4545345'
|
||||
const hash = undefined
|
||||
const historyId = 91525
|
||||
const path = '/some/path/here.jpg'
|
||||
|
||||
await this.TpdsUpdateSender.promises.addFile({
|
||||
projectId,
|
||||
historyId,
|
||||
fileId,
|
||||
hash,
|
||||
path,
|
||||
projectName,
|
||||
})
|
||||
|
||||
expect(this.FetchUtils.fetchNothing).to.have.been.calledWithMatch(
|
||||
this.enqueueUrl,
|
||||
{
|
||||
json: {
|
||||
group: userId,
|
||||
method: 'pipeStreamFrom',
|
||||
job: {
|
||||
method: 'post',
|
||||
streamOrigin: `${filestoreUrl}/project/${projectId}/file/${fileId}`,
|
||||
uri: `${thirdPartyDataStoreApiUrl}/user/${userId}/entity/${encodeURIComponent(
|
||||
projectName
|
||||
)}${encodeURIComponent(path)}`,
|
||||
headers: {},
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
expect(this.FetchUtils.fetchNothing).to.have.been.calledWithMatch(
|
||||
this.enqueueUrl,
|
||||
{
|
||||
json: {
|
||||
group: collaberatorRef,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
expect(this.FetchUtils.fetchNothing).to.have.been.calledWithMatch(
|
||||
this.enqueueUrl,
|
||||
{
|
||||
json: {
|
||||
group: readOnlyRef,
|
||||
job: {},
|
||||
},
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
it('queues a post the file with user and file id and hash', async function () {
|
||||
const fileId = '4545345'
|
||||
const hash = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
const historyId = 91525
|
||||
|
||||
Reference in New Issue
Block a user