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

Cleanup nodejs test function naming, remove duplicated test #564

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions agents/node/vcxagent-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
"demo:faber:mysql": "node demo/faber.js --mysql",
"demo:alice:sign": "node demo/alice-signature.js",
"demo:faber:verify": "node demo/faber-verify-signature.js",
"test:integration": "npm run test:integration:update-state && npm run test:integration:signing && npm run test:integration:messaging && npm run test:integration:tails && npm run test:integration:trustping && npm run test:integration:feature-discovery && npm run test:integration:public-invite && npm run test:integration:out-of-band",
"test:integration:update-state": "jest --forceExit --env=node --runInBand test/update-state-v2.spec.js",
"test:integration:cred-def": "jest --forceExit --env=node --runInBand test/credential-def-v2.spec.js",
"test:integration": "npm run test:integration:issue-verify && npm run test:integration:signing && npm run test:integration:messaging && npm run test:integration:tails && npm run test:integration:trustping && npm run test:integration:feature-discovery && npm run test:integration:public-invite && npm run test:integration:out-of-band",
"test:integration:issue-verify": "jest --forceExit --env=node --runInBand test/issue-verify.spec.js",
"test:integration:signing": "jest --forceExit --env=node --runInBand test/sign-verify.spec.js",
"test:integration:messaging": "jest --forceExit --env=node --runInBand test/sign-messaging.spec.js",
"test:integration:tails": "jest --forceExit --env=node --runInBand test/distribute-tails.spec.js",
Expand Down
42 changes: 0 additions & 42 deletions agents/node/vcxagent-core/test/credential-def-v2.spec.js

This file was deleted.

12 changes: 6 additions & 6 deletions agents/node/vcxagent-core/test/distribute-tails.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ describe('test tails distribution', () => {
const port = 5468
const tailsUrlId = uuid.v4()
const tailsUrl = `http://127.0.0.1:${port}/${tailsUrlId}`
await faber.buildLedgerPrimitivesV2(buildRevocationDetails({ supportRevocation: true, tailsDir: `${__dirname}/tmp/faber/tails`, maxCreds: 5, tailsUrl }))
await faber.sendCredentialOfferV2()
await faber.buildLedgerPrimitives(buildRevocationDetails({ supportRevocation: true, tailsDir: `${__dirname}/tmp/faber/tails`, maxCreds: 5, tailsUrl }))
await faber.sendCredentialOffer()
await alice.acceptCredentialOffer()
await faber.updateStateCredentialV2(IssuerStateType.RequestReceived)
await faber.updateStateCredential(IssuerStateType.RequestReceived)
await faber.sendCredential()
await alice.updateStateCredentialV2(HolderStateType.Finished)
await alice.updateStateCredential(HolderStateType.Finished)

const faberTailsHash = await faber.getTailsHash()
const app = express()
Expand All @@ -48,8 +48,8 @@ describe('test tails distribution', () => {

const request = await faber.requestProofFromAlice()
await alice.sendHolderProof(JSON.parse(request), revRegId => aliceTailsFileDir)
await faber.updateStateVerifierProofV2(VerifierStateType.Finished)
await alice.updateStateHolderProofV2(ProverStateType.Finished)
await faber.updateStateVerifierProof(VerifierStateType.Finished)
await alice.updateStateHolderProof(ProverStateType.Finished)
} catch (err) {
console.error(`err = ${err.message} stack = ${err.stack}`)
if (server) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@ describe('test update state', () => {
try {
const { alice, faber } = await createPairedAliceAndFaber()
const tailsDir = `${__dirname}/tmp/faber/tails`
await faber.buildLedgerPrimitivesV2({ tailsDir, maxCreds: 5 })
await faber.sendCredentialOfferV2()
await faber.buildLedgerPrimitives({ tailsDir, maxCreds: 5 })
await faber.rotateRevReg(tailsDir, 5)
await faber.sendCredentialOffer()
await alice.acceptCredentialOffer()

await faber.updateStateCredentialV2(IssuerStateType.RequestReceived)
await faber.updateStateCredential(IssuerStateType.RequestReceived)
await faber.sendCredential()
await alice.updateStateCredentialV2(HolderStateType.Finished)
await alice.updateStateCredential(HolderStateType.Finished)
await faber.receiveCredentialAck()

const request = await faber.requestProofFromAlice()
await alice.sendHolderProof(JSON.parse(request), revRegId => tailsDir)
await faber.updateStateVerifierProofV2(VerifierStateType.Finished)
await alice.updateStateHolderProofV2(ProverStateType.Finished)
await faber.updateStateVerifierProof(VerifierStateType.Finished)
await alice.updateStateHolderProof(ProverStateType.Finished)
} catch (err) {
console.error(`err = ${err.message} stack = ${err.stack}`)
await sleep(2000)
Expand Down
16 changes: 8 additions & 8 deletions agents/node/vcxagent-core/test/out-of-band.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ describe('test out of band communication', () => {
try {
const { alice, faber } = await createAliceAndFaber()
const tailsDir = `${__dirname}/tmp/faber/tails`
await faber.buildLedgerPrimitivesV2({ tailsDir, maxCreds: 5 })
await faber.buildLedgerPrimitives({ tailsDir, maxCreds: 5 })
const oobCredOfferMsg = await faber.createOobCredOffer()

await connectViaOobMessage(alice, faber, oobCredOfferMsg)

await alice.acceptOobCredentialOffer(oobCredOfferMsg)
await faber.updateStateCredentialV2(IssuerStateType.RequestReceived)
await faber.updateStateCredential(IssuerStateType.RequestReceived)
await faber.sendCredential()
await alice.updateStateCredentialV2(HolderStateType.Finished)
await alice.updateStateCredential(HolderStateType.Finished)
} catch (e) {
console.error(e.stack)
await sleep(1000)
Expand All @@ -75,19 +75,19 @@ describe('test out of band communication', () => {
try {
const { alice, faber } = await createPairedAliceAndFaber()
const tailsDir = `${__dirname}/tmp/faber/tails`
await faber.buildLedgerPrimitivesV2({ tailsDir, maxCreds: 5 })
await faber.sendCredentialOfferV2()
await faber.buildLedgerPrimitives({ tailsDir, maxCreds: 5 })
await faber.sendCredentialOffer()
await alice.acceptCredentialOffer()
await faber.updateStateCredentialV2(IssuerStateType.RequestReceived)
await faber.updateStateCredential(IssuerStateType.RequestReceived)
await faber.sendCredential()
await alice.updateStateCredentialV2(HolderStateType.Finished)
await alice.updateStateCredential(HolderStateType.Finished)

const oobPresentationRequestMsg = await faber.createOobProofRequest()

const oobReceiver = await OutOfBandReceiver.createWithMessage(oobPresentationRequestMsg)
const presentationRequest = await oobReceiver.extractMessage()
await alice.sendHolderProof(presentationRequest, revRegId => tailsDir)
await faber.updateStateVerifierProofV2(VerifierStateType.Finished)
await faber.updateStateVerifierProof(VerifierStateType.Finished)
} catch (e) {
console.error(e.stack)
await sleep(1000)
Expand Down
8 changes: 4 additions & 4 deletions agents/node/vcxagent-core/test/utils/alice.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports.createAlice = async function createAlice () {
await vcxAgent.agentShutdownVcx()
}

async function updateStateHolderProofV2 (expectedNextState) {
async function updateStateHolderProof (expectedNextState) {
logger.info(`Holder updating state of disclosed proof, expecting it to be in state ${expectedNextState}`)
await vcxAgent.agentInitVcx()

Expand All @@ -120,7 +120,7 @@ module.exports.createAlice = async function createAlice () {
await vcxAgent.agentShutdownVcx()
}

async function updateStateCredentialV2 (expectedState) {
async function updateStateCredential (expectedState) {
logger.info('Holder updating state of credential with connection')
await vcxAgent.agentInitVcx()

Expand Down Expand Up @@ -212,9 +212,9 @@ module.exports.createAlice = async function createAlice () {
updateConnection,
handleMessage,
acceptCredentialOffer,
updateStateCredentialV2,
updateStateCredential,
sendHolderProof,
updateStateHolderProofV2,
updateStateHolderProof,
getTailsLocation,
getTailsHash,
downloadReceivedMessagesV2,
Expand Down
16 changes: 8 additions & 8 deletions agents/node/vcxagent-core/test/utils/faber.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ module.exports.createFaber = async function createFaber () {
await vcxAgent.agentShutdownVcx()
}

async function buildLedgerPrimitivesV2 (revocationDetails) {
async function buildLedgerPrimitives (revocationDetails) {
await vcxAgent.agentInitVcx()

logger.info('Faber writing schema on ledger')
Expand Down Expand Up @@ -172,7 +172,7 @@ module.exports.createFaber = async function createFaber () {
await vcxAgent.agentShutdownVcx()
}

async function sendCredentialOfferV2 () {
async function sendCredentialOffer () {
await vcxAgent.agentInitVcx()

logger.info('Issuer sending credential offer')
Expand All @@ -182,7 +182,7 @@ module.exports.createFaber = async function createFaber () {

await vcxAgent.agentShutdownVcx()
}
async function updateStateCredentialV2 (expectedState) {
async function updateStateCredential (expectedState) {
await vcxAgent.agentInitVcx()

logger.info('Issuer updating state of credential with connection')
Expand Down Expand Up @@ -225,7 +225,7 @@ module.exports.createFaber = async function createFaber () {
return proofRequestMessage
}

async function updateStateVerifierProofV2 (expectedNextState) {
async function updateStateVerifierProof (expectedNextState) {
logger.info(`Verifier updating state of proof, expecting it to be in state ${expectedNextState}`)
await vcxAgent.agentInitVcx()

Expand Down Expand Up @@ -325,7 +325,7 @@ module.exports.createFaber = async function createFaber () {
}

return {
buildLedgerPrimitivesV2,
buildLedgerPrimitives,
rotateRevReg,
downloadReceivedMessages,
downloadReceivedMessagesV2,
Expand All @@ -340,13 +340,13 @@ module.exports.createFaber = async function createFaber () {
updateConnection,
handleMessage,
sendConnectionResponse,
sendCredentialOfferV2,
sendCredentialOffer,
createOobCredOffer,
updateStateCredentialV2,
updateStateCredential,
sendCredential,
receiveCredentialAck,
requestProofFromAlice,
updateStateVerifierProofV2,
updateStateVerifierProof,
getCredentialRevRegId,
getTailsFile,
getTailsHash,
Expand Down