Skip to content

Commit

Permalink
Make tests more precise
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Mar 18, 2021
1 parent 7f0a6fe commit fe7a856
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions test/integration/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ describe('Contract', function () {
try {
await contract.contractCompile(contractWithLib)
} catch (e) {
e.message.indexOf('Couldn\'t find include file').should.not.be.equal(-1)
e.message.should.include('Couldn\'t find include file')
}
})
it('Can deploy contract with external deps', async () => {
Expand All @@ -447,7 +447,7 @@ describe('Contract', function () {
deployedStatic.result.should.have.property('returnType')

const encodedCallData = await compiled.encodeCall('sumNumbers', ['1', '2'])
encodedCallData.indexOf('cb_').should.not.be.equal(-1)
encodedCallData.should.satisfy(s => s.startsWith('cb_'))
})
it('Can call contract with external deps', async () => {
const callResult = await deployed.call('sumNumbers', ['1', '2'])
Expand All @@ -471,7 +471,7 @@ describe('Contract', function () {
compiler.compilerVersion = '1.0.0'
await compiler.checkCompatibility()
} catch (e) {
e.message.indexOf('Unsupported compiler version 1.0.0').should.not.be.equal(-1)
e.message.should.satisfy(s => s.startsWith('Unsupported compiler version 1.0.0'))
}
})
it('compile', async () => {
Expand Down Expand Up @@ -997,8 +997,7 @@ describe('Contract', function () {
try {
await contractObject.methods.hashFn(decoded)
} catch (e) {
const isSizeCheck = e.message.indexOf('not a 32 bytes') !== -1
isSizeCheck.should.be.equal(true)
e.message.should.include('not a 32 bytes')
}
})
it('Valid', async () => {
Expand All @@ -1024,8 +1023,7 @@ describe('Contract', function () {
try {
await contractObject.methods.signatureFn(decoded)
} catch (e) {
const isSizeCheck = e.message.indexOf('not a 64 bytes') !== -1
isSizeCheck.should.be.equal(true)
e.message.should.include('not a 64 bytes')
}
})
it('Valid', async () => {
Expand All @@ -1052,8 +1050,7 @@ describe('Contract', function () {
try {
await contractObject.methods.bytesFn(Buffer.from([...decoded, 2]))
} catch (e) {
const isSizeCheck = e.message.indexOf('not a 32 bytes') !== -1
isSizeCheck.should.be.equal(true)
e.message.should.include('not a 32 bytes')
}
})
it('Valid', async () => {
Expand Down

0 comments on commit fe7a856

Please sign in to comment.