monitors/monitor.js
// If it matches, update our tracked value and continue. If it doesn't, fail the test.
If it matches, update our tracked value and continue. If it doesn't, fail the test.
If it matches update our tracked value and continue . If it doesn ' t fail the test .
async expect(value, message) {
    let actualValue = await this.fetchValue();
    let expectedValue = this.adjustExpectation(value);
    if (typeof actualValue == 'number') {
      actualValue = asBN(actualValue);
    }
    if (typeof expectedValue == 'number') {
      expectedValue = asBN(expectedValue);
    }
    if (!((typeof actualValue) == (typeof expectedValue))) {
      assert.fail(`Type mismatch in expectation: ${typeof actualValue} != ${typeof expectedValue}`);
    }
    if (!this.equals(actualValue, expectedValue)) {
      if (web3.utils.isBN(actualValue) && web3.utils.isBN(expectedValue)) {
        console.log(`Difference detected: ${actualValue.toString()} - ${expectedValue.toString()} = ${actualValue.sub(expectedValue).toString()} (${web3.utils.fromWei(actualValue.sub(expectedValue) , "ether")} eth)`)
      }
      assert.fail(`${this.toString()}: Error validating state (expected=${expectedValue}, actual=${actualValue}) ${this.errorMsg || ""}`);
    }
    console.log(`${this.toString()}: changed from (${this.lastValue}) => (${actualValue})`);
    await this.reset(actualValue);
  }
async expect ( value , message ) { let actualValue = await this . fetchValue ( ) ; let expectedValue = this . adjustExpectation ( value ) ; if ( typeof actualValue == 'number' ) { actualValue = asBN ( actualValue ) ; } if ( typeof expectedValue == 'number' ) { expectedValue = asBN ( expectedValue ) ; } if ( ! ( ( typeof actualValue ) == ( typeof expectedValue ) ) ) { assert . fail ( ` ${ typeof actualValue } ${ typeof expectedValue } ` ) ; } if ( ! this . equals ( actualValue , expectedValue ) ) { if ( web3 . utils . isBN ( actualValue ) && web3 . utils . isBN ( expectedValue ) ) { console . log ( ` ${ actualValue . toString ( ) } ${ expectedValue . toString ( ) } ${ actualValue . sub ( expectedValue ) . toString ( ) } ${ web3 . utils . fromWei ( actualValue . sub ( expectedValue ) , "ether" ) } ` ) } assert . fail ( ` ${ this . toString ( ) } ${ expectedValue } ${ actualValue } ${ this . errorMsg || "" } ` ) ; } console . log ( ` ${ this . toString ( ) } ${ this . lastValue } ${ actualValue } ` ) ; await this . reset ( actualValue ) ; }
If it matches, update our tracked value and continue.
If it matches update our tracked value and continue .