Skip to content

Commit

Permalink
Update numberGuess.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufidimaina9989 authored Oct 27, 2023
1 parent 9bf4c07 commit 2db60a3
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions tests/numberGuess.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,26 @@ import { getDefaultSigner, randomPrivateKey } from './utils/helper'

import { expect } from 'chai'

async function main() {
describe('Test SmartContract `NumberGuess`', () => {
let numbergs : NumberGuess
before(async () => {
NumberGuess.loadArtifact()

const [privateKeyalice, publicKeyalice] = randomPrivateKey()
const [privateKeybob, publicKeybob] = randomPrivateKey()

const numbergs = new NumberGuess(
numbergs = new NumberGuess(
PubKey(publicKeyalice.toByteString()),
PubKey(publicKeybob.toByteString()),
3n,
3n
)

await numbergs.connect(getDefaultSigner([privateKeyalice, privateKeybob]))
})

const deployTx = await numbergs.deploy(1)
console.log('NumberGuess contract deployed: ', deployTx.id)
it('should pass the public method successfully' , async () => {
await numbergs.deploy(1)

const call = async () => {
const { tx: callTx, atInputIndex } = await numbergs.methods.guess(
Expand All @@ -29,14 +32,8 @@ async function main() {
pubKeyOrAddrToSign: publicKeybob,

Check failure on line 32 in tests/numberGuess.test.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Cannot find name 'publicKeybob'.
} as MethodCallOptions<NumberGuess>
)
console.log('NumberGuess contract called: ', callTx.id)
}

await expect(call()).to.be.not.rejected
}

describe('Test SmartContract `NumberGS` unit test', () => {
it('should succeed', async () => {
await main()
})
})
})

0 comments on commit 2db60a3

Please sign in to comment.