Merge pull request #115 from Unirep/username-route-fix

Username route test fixes
This commit is contained in:
Yuriko
2022-10-02 02:15:49 +09:00
committed by GitHub
3 changed files with 14 additions and 13 deletions

View File

@@ -111,5 +111,12 @@ export async function startServer(contractOverrides = {}) {
(await unirep.attesters(unirepSocial.address)).toNumber()
)
await new Promise((r) => app.listen(port, r as any))
return { ...data, constants, url, attesterId, db: appDB }
return {
...data,
constants,
url,
attesterId,
db: appDB,
txManager: appTxManager,
}
}

View File

@@ -21,10 +21,9 @@ test.before(async (t: any) => {
Object.assign(t.context, context)
})
test('should set a username', async (t: any) => {
test.serial('should set a username', async (t: any) => {
// sign up and sign in user
const { iden, commitment } = await signUp(t)
await signIn(t, commitment)
// first set a username
// pre-image by default is 0
@@ -62,7 +61,6 @@ test.serial(
async (t: any) => {
// sign up and sign in user
const { iden, commitment } = await signUp(t)
await signIn(t, commitment)
// first set a username
// pre-image by default is 0
@@ -94,10 +92,9 @@ test.serial(
}
)
test.serial('should fail to set with invalid proof', async (t: any) => {
test('should fail to set with invalid proof', async (t: any) => {
// sign up and sign in user
const { iden, commitment } = await signUp(t)
await signIn(t, commitment)
// first set a username
// pre-image by default is 0

View File

@@ -316,13 +316,10 @@ export const vote = async (
}
export const epochTransition = async (t) => {
const r = await fetch(`${t.context.url}/api/epochTransition`, {
method: 'POST',
headers: {
authorization: 'NLmKDUnJUpc6VzuPc7Wm',
},
})
t.is(r.status, 204)
const { txManager, unirep } = t.context
const calldata = unirep.interface.encodeFunctionData('beginEpochTransition')
const hash = await txManager.queueTransaction(unirep.address, calldata)
await t.context.unirep.provider.waitForTransaction(hash)
}
export const userStateTransition = async (t, iden) => {