Skip to content

Commit

Permalink
Update base58.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufidimaina9989 authored Oct 15, 2023
1 parent 5e72bb9 commit ba2ca61
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/base58.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { toByteString } from 'scrypt-ts'
import { Base58Test } from '../src/contracts/base58'
import { Base58Test, Base58 } from '../src/contracts/base58'
import { getDefaultSigner } from './utils/helper'
import { expect, use } from 'chai'
import chaiAsPromised from 'chai-as-promised'
use(chaiAsPromised)

describe('Test SmartContract `Base58`', async () => {
let instance: Base58Test

Expand All @@ -16,9 +15,16 @@ describe('Test SmartContract `Base58`', async () => {

it('should encode address correctly', async () => {
await instance.deploy(1)
const callContract = async () => {
await instance.methods.main(toByteString('1234567890abcdef', true))
}
return expect(callContract()).not.be.rejected
const sampleAddress = toByteString('abcdefghabcdefghabcdefgh',true)

// Get the expected verification byte for testnet
const verbyte = Base58.P2PKH_verbyte_testnet;

// Call the base58EncodeCheckAddr function
const result = Base58.base58EncodeCheckAddr(sampleAddress, verbyte);

// Assert that the result does not throw
expect(result).not.throw

})
})

0 comments on commit ba2ca61

Please sign in to comment.