Skip to content

Commit

Permalink
fix(cli): add test to authorize gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
fforbeck committed Dec 12, 2024
1 parent 4c03d6d commit bfc9d68
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions packages/cli/test/bin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,43 @@ export const testSpace = {
assert.match(error, /wait.*plan.*select/i)
}),

'storacha space create home --no-recovery --customer [email protected] --account [email protected] --authorize-gateway-services':
test(async (assert, context) => {
const email = '[email protected]'
await login(context, { email })
await selectPlan(context, { email })

const serverId = context.connection.id
const serverURL = context.serverURL

const { output } = await storacha
.args([
'space',
'create',
'home',
'--no-recovery',
'--customer',
email,
'--account',
email,
'--authorize-gateway-services',
`[{"id":"${serverId}","serviceEndpoint":"${serverURL}"}]`,
])
.env(context.env.alice)
.join()

assert.match(output, /account is authorized/i)

const result = await context.delegationsStorage.find({
audience: DIDMailto.fromEmail(email),
})

assert.ok(
result.ok?.find((d) => d.capabilities[0].can === '*'),
'account has been delegated access to the space'
)
}),

'storacha space add': test(async (assert, context) => {
const { env } = context

Expand Down

0 comments on commit bfc9d68

Please sign in to comment.