|
|
|
@ -230,7 +230,7 @@ export const SolidityUnitTesting = (props: any) => { |
|
|
|
|
} else if (result.type === 'testFailure') { |
|
|
|
|
// if (result.hhLogs && result.hhLogs.length) this.printHHLogs(result.hhLogs, result.value)
|
|
|
|
|
if (!result.assertMethod) { |
|
|
|
|
const testFailCard: any = (<div |
|
|
|
|
const testFailCard1: any = (<div |
|
|
|
|
className="bg-light mb-2 px-2 testLog d-flex flex-column text-danger border-0" |
|
|
|
|
id={"UTContext" + result.context} |
|
|
|
|
// onClick=${() => this.highlightLocation(result.location, runningTests, result.filename)}
|
|
|
|
@ -242,36 +242,34 @@ export const SolidityUnitTesting = (props: any) => { |
|
|
|
|
<span className="text-dark">Error Message:</span> |
|
|
|
|
<span className="pb-2 text-break">"{result.errMsg}"</span> |
|
|
|
|
</div>) |
|
|
|
|
setTestsOutput(prevCards => ([...prevCards, testFailCard])) |
|
|
|
|
setTestsOutput(prevCards => ([...prevCards, testFailCard1])) |
|
|
|
|
} else { |
|
|
|
|
const preposition = result.assertMethod === 'equal' || result.assertMethod === 'notEqual' ? 'to' : '' |
|
|
|
|
const method = result.assertMethod === 'ok' ? '' : result.assertMethod |
|
|
|
|
const expected = result.assertMethod === 'ok' ? '\'true\'' : result.expected |
|
|
|
|
const testFailCard2: any = (<div |
|
|
|
|
className="bg-light mb-2 px-2 testLog d-flex flex-column text-danger border-0" |
|
|
|
|
id="UTContext${result.context}" |
|
|
|
|
// onclick=${() => this.highlightLocation(result.location, runningTests, result.filename)}
|
|
|
|
|
> |
|
|
|
|
<div className="d-flex my-1 align-items-start justify-content-between">
|
|
|
|
|
<span> ✘ {result.value}</span> |
|
|
|
|
{/* ${debugBtn} */} |
|
|
|
|
</div>
|
|
|
|
|
<span className="text-dark">Error Message:</span> |
|
|
|
|
<span className="pb-2 text-break">"{result.errMsg}"</span> |
|
|
|
|
<span className="text-dark">Assertion:</span> |
|
|
|
|
<div className="d-flex flex-wrap"> |
|
|
|
|
<span>Expected value should be</span> |
|
|
|
|
<div className="mx-1 font-weight-bold">{method}</div> |
|
|
|
|
<div>{preposition} {expected}</div> |
|
|
|
|
</div> |
|
|
|
|
<span className="text-dark">Received value:</span> |
|
|
|
|
<span>{result.returned}</span> |
|
|
|
|
<span className="text-dark text-sm pb-2">Skipping the remaining tests of the function.</span> |
|
|
|
|
</div>) |
|
|
|
|
setTestsOutput(prevCards => ([...prevCards, testFailCard2])) |
|
|
|
|
} |
|
|
|
|
// else {
|
|
|
|
|
// const preposition = result.assertMethod === 'equal' || result.assertMethod === 'notEqual' ? 'to' : ''
|
|
|
|
|
// const method = result.assertMethod === 'ok' ? '' : result.assertMethod
|
|
|
|
|
// const expected = result.assertMethod === 'ok' ? '\'true\'' : result.expected
|
|
|
|
|
// this.testsOutput.appendChild(yo`
|
|
|
|
|
// <div
|
|
|
|
|
// class="bg-light mb-2 px-2 ${css.testLog} d-flex flex-column text-danger border-0"
|
|
|
|
|
// id="UTContext${result.context}"
|
|
|
|
|
// onclick=${() => this.highlightLocation(result.location, runningTests, result.filename)}
|
|
|
|
|
// >
|
|
|
|
|
// <div class="d-flex my-1 align-items-start justify-content-between">
|
|
|
|
|
// <span> ✘ ${result.value}</span>
|
|
|
|
|
// ${debugBtn}
|
|
|
|
|
// </div>
|
|
|
|
|
// <span class="text-dark">Error Message:</span>
|
|
|
|
|
// <span class="pb-2 text-break">"${result.errMsg}"</span>
|
|
|
|
|
// <span class="text-dark">Assertion:</span>
|
|
|
|
|
// <div class="d-flex flex-wrap">
|
|
|
|
|
// <span>Expected value should be</span>
|
|
|
|
|
// <div class="mx-1 font-weight-bold">${method}</div>
|
|
|
|
|
// <div>${preposition} ${expected}</div>
|
|
|
|
|
// </div>
|
|
|
|
|
// <span class="text-dark">Received value:</span>
|
|
|
|
|
// <span>${result.returned}</span>
|
|
|
|
|
// <span class="text-dark text-sm pb-2">Skipping the remaining tests of the function.</span>
|
|
|
|
|
// </div>
|
|
|
|
|
// `)
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
//else if (result.type === 'logOnly') {
|
|
|
|
|
// if (result.hhLogs && result.hhLogs.length) this.printHHLogs(result.hhLogs, result.value)
|
|
|
|
|