passing all tests

pull/5370/head
Sab94 6 years ago
parent 2789f43285
commit 2d55e3398b
  1. 97
      remix-tests/tests/testRunner.ts

@ -111,5 +111,102 @@ function compileAndDeploy (filename: string, callback: Function) {
]) ])
}) })
}) })
// Test string equality
describe('test string equality', function () {
let filename = 'tests/examples_3/simple_string_test.sol'
let tests: any[] = [], results: ResultsInterface;
before(function (done) {
compileAndDeploy(filename, function (_err, compilationData, contracts, accounts) {
var testCallback: TestCbInterface = (err, test) => {
if (err) { throw err }
tests.push(test)
}
var resultsCallback: ResultCbInterface = (err, _results) => {
if (err) { throw err }
results = _results
done()
}
runTest('StringTest', contracts.StringTest, compilationData[filename]['StringTest'], { accounts }, testCallback, resultsCallback)
runTest('StringTest2', contracts.StringTest2, compilationData[filename]['StringTest2'], { accounts }, testCallback, resultsCallback)
})
})
it('should 2 passing tests', function () {
assert.equal(results.passingNum, 2)
})
it('should 1 failing tests', function () {
assert.equal(results.failureNum, 1)
})
it('should returns 3 messages', function () {
assert.deepEqual(tests, [
{ type: 'contract', value: 'StringTest', filename: 'tests/examples_3/simple_string_test.sol' },
{ type: 'testFailure', value: 'Value should be hello world', time: 1, context: 'StringTest', "errMsg": "initial value is not correct" },
{ type: 'testPass', value: 'Value should not be hello wordl', time: 1, context: 'StringTest' },
{ type: 'testPass', value: 'Initial value should be hello', time: 1, context: 'StringTest' },
])
})
})
//Test signed/unsigned integer weight
describe('test number weight', function () {
let filename = 'tests/number/number_test.sol'
let tests: any[] = [], results: ResultsInterface;
before(function (done) {
compileAndDeploy(filename, function (_err, compilationData, contracts, accounts) {
var testCallback: TestCbInterface = (err, test) => {
if (err) { throw err }
tests.push(test)
}
var resultsCallback: ResultCbInterface = (err, _results) => {
if (err) { throw err }
results = _results
done()
}
runTest('IntegerTest', contracts.IntegerTest, compilationData[filename]['IntegerTest'], { accounts }, testCallback, resultsCallback)
})
})
it('should have 6 passing tests', function () {
assert.equal(results.passingNum, 6)
})
it('should have 2 failing tests', function () {
assert.equal(results.failureNum, 2)
})
})
// Test Transaction with different sender
describe('various sender', function () {
let filename = 'tests/various_sender/sender_test.sol'
let tests: any[] = [], results: ResultsInterface;
before(function (done) {
compileAndDeploy(filename, function (_err, compilationData, contracts, accounts) {
var testCallback: TestCbInterface = (err, test) => {
if (err) { throw err }
tests.push(test)
}
var resultsCallback: ResultCbInterface = (err, _results) => {
if (err) { throw err }
results = _results
done()
}
runTest('SenderTest', contracts.SenderTest, compilationData[filename]['SenderTest'], { accounts }, testCallback, resultsCallback)
})
})
it('should have 4 passing tests', function () {
assert.equal(results.passingNum, 4)
})
it('should have 1 failing tests', function () {
assert.equal(results.failureNum, 0)
})
})
}) })
}) })

Loading…
Cancel
Save