Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: redundant proofs failing provision requests #1150

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions packages/w3up-client/test/account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,42 @@ export const testAccount = {

assert.deepEqual(client.currentSpace()?.did(), space.did())
},

'only redundant logins': async (
assert,
{ client, mail, grantAccess, plansStorage }
) => {
const email = '[email protected]'
const sessions = []
const pairs = 2
for (const _ of Array(pairs)) {
const login = Account.login(client, email)
// do not grant access right away so we end up with distinct sessions
await new Promise((resolve) => setTimeout(resolve, 1000))
await grantAccess(await mail.take())
const account = Result.try(await login)
sessions.push(account)
}

// we create temporary account sessions and then save them to avoid
// login idempotence.
for (const session of sessions) {
Result.try(await session.save())
}

const account = Object.values(client.accounts())[0]
assert.equal(
account.proofs.length,
pairs * 2,
`should have ${pairs * 2} proofs`
)

// setup a billing for this account
plansStorage.set(account.did(), client.agent.connection.id.did())

const space = await client.createSpace('test')
account.provision(space.did())
},
}

Test.test({ Account: testAccount })
Loading