mirror of
https://github.com/Unirep/Unirep-Social.git
synced 2026-01-10 06:27:58 -05:00
Merge pull request #115 from Unirep/username-route-fix
Username route test fixes
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user