Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
chore: fix up ref formatting test
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Sep 23, 2020
1 parent fa83a26 commit ac5f0d6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/ipfs-http-server/test/inject/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ describe('/files', () => {
edges: false,
unique: false,
maxDepth: undefined,
format: undefined,
signal: sinon.match.instanceOf(AbortSignal),
timeout: undefined
}
Expand All @@ -526,6 +527,23 @@ describe('/files', () => {
expect(JSON.parse(res.result)).to.have.property('Ref', cid.toString())
})

it('should format refs', async () => {
ipfs.refs.withArgs([`${cid}`], {
...defaultOptions,
format: 'format'
}).returns([{
ref: cid.toString()
}])

const res = await http({
method: 'POST',
url: `/api/v0/refs?arg=${cid}&format=format`
}, { ipfs })

expect(res).to.have.property('statusCode', 200)
expect(JSON.parse(res.result)).to.have.property('Ref', cid.toString())
})

it('should list refs for multiple IPFS paths', async () => {
ipfs.refs.withArgs([`${cid}`, `/ipfs/${cid2}`], defaultOptions).returns([{
ref: cid.toString()
Expand Down

0 comments on commit ac5f0d6

Please sign in to comment.