Use hardhat-exposed to reduce the need for mocks (#3666)
Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
@ -2,33 +2,33 @@ const { BN, constants } = require('@openzeppelin/test-helpers');
|
||||
const { expect } = require('chai');
|
||||
const { MIN_INT256, MAX_INT256 } = constants;
|
||||
|
||||
const SignedMathMock = artifacts.require('SignedMathMock');
|
||||
const SignedMath = artifacts.require('$SignedMath');
|
||||
|
||||
contract('SignedMath', function () {
|
||||
const min = new BN('-1234');
|
||||
const max = new BN('5678');
|
||||
|
||||
beforeEach(async function () {
|
||||
this.math = await SignedMathMock.new();
|
||||
this.math = await SignedMath.new();
|
||||
});
|
||||
|
||||
describe('max', function () {
|
||||
it('is correctly detected in first argument position', async function () {
|
||||
expect(await this.math.max(max, min)).to.be.bignumber.equal(max);
|
||||
expect(await this.math.$max(max, min)).to.be.bignumber.equal(max);
|
||||
});
|
||||
|
||||
it('is correctly detected in second argument position', async function () {
|
||||
expect(await this.math.max(min, max)).to.be.bignumber.equal(max);
|
||||
expect(await this.math.$max(min, max)).to.be.bignumber.equal(max);
|
||||
});
|
||||
});
|
||||
|
||||
describe('min', function () {
|
||||
it('is correctly detected in first argument position', async function () {
|
||||
expect(await this.math.min(min, max)).to.be.bignumber.equal(min);
|
||||
expect(await this.math.$min(min, max)).to.be.bignumber.equal(min);
|
||||
});
|
||||
|
||||
it('is correctly detected in second argument position', async function () {
|
||||
expect(await this.math.min(max, min)).to.be.bignumber.equal(min);
|
||||
expect(await this.math.$min(max, min)).to.be.bignumber.equal(min);
|
||||
});
|
||||
});
|
||||
|
||||
@ -68,7 +68,7 @@ contract('SignedMath', function () {
|
||||
|
||||
for (const x of valuesX) {
|
||||
for (const y of valuesY) {
|
||||
expect(await this.math.average(x, y))
|
||||
expect(await this.math.$average(x, y))
|
||||
.to.be.bignumber.equal(bnAverage(x, y), `Bad result for average(${x}, ${y})`);
|
||||
}
|
||||
}
|
||||
@ -86,7 +86,7 @@ contract('SignedMath', function () {
|
||||
MAX_INT256,
|
||||
]) {
|
||||
it(`correctly computes the absolute value of ${n}`, async function () {
|
||||
expect(await this.math.abs(n)).to.be.bignumber.equal(n.abs());
|
||||
expect(await this.math.$abs(n)).to.be.bignumber.equal(n.abs());
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user