Skip to content

Commit

Permalink
test: add mock response to filecoin api info for cli: (#1134)
Browse files Browse the repository at this point in the history
Enables CLI testing as these are imported there
  • Loading branch information
vasco-santos authored Apr 15, 2024
1 parent 8ee276d commit bc529f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/filecoin-api/test/context/mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function mockService(impl) {
offer: withCallParams(impl.filecoin?.offer ?? notImplemented),
submit: withCallParams(impl.filecoin?.submit ?? notImplemented),
accept: withCallParams(impl.filecoin?.accept ?? notImplemented),
info: withCallParams(impl.filecoin?.info ?? notImplemented),
},
piece: {
offer: withCallParams(impl.piece?.offer ?? notImplemented),
Expand Down
13 changes: 13 additions & 0 deletions packages/filecoin-api/test/context/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,19 @@ export function getMockService() {
return result
},
}),
info: Server.provideAdvanced({
capability: StorefrontCaps.filecoinInfo,
handler: async ({ invocation, context }) => {
const invCap = invocation.capabilities[0]
if (!invCap.nb?.piece) {
throw new Error()
}
return Server.ok({
piece: invCap.nb.piece,
aggregates: [],
deals: []
})
}})
},
deal: {
info: Server.provideAdvanced({
Expand Down

0 comments on commit bc529f0

Please sign in to comment.