Use Prettier for JS files (#3913)
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
This commit is contained in:
@ -9,7 +9,7 @@ contract('SafeCast', async function () {
|
||||
this.safeCast = await SafeCast.new();
|
||||
});
|
||||
|
||||
function testToUint (bits) {
|
||||
function testToUint(bits) {
|
||||
describe(`toUint${bits}`, () => {
|
||||
const maxValue = new BN('2').pow(new BN(bits)).subn(1);
|
||||
|
||||
@ -60,21 +60,15 @@ contract('SafeCast', async function () {
|
||||
});
|
||||
|
||||
it('reverts when casting -1', async function () {
|
||||
await expectRevert(
|
||||
this.safeCast.$toUint256(-1),
|
||||
'SafeCast: value must be positive',
|
||||
);
|
||||
await expectRevert(this.safeCast.$toUint256(-1), 'SafeCast: value must be positive');
|
||||
});
|
||||
|
||||
it(`reverts when casting INT256_MIN (${minInt256})`, async function () {
|
||||
await expectRevert(
|
||||
this.safeCast.$toUint256(minInt256),
|
||||
'SafeCast: value must be positive',
|
||||
);
|
||||
await expectRevert(this.safeCast.$toUint256(minInt256), 'SafeCast: value must be positive');
|
||||
});
|
||||
});
|
||||
|
||||
function testToInt (bits) {
|
||||
function testToInt(bits) {
|
||||
describe(`toInt${bits}`, () => {
|
||||
const minValue = new BN('-2').pow(new BN(bits - 1));
|
||||
const maxValue = new BN('2').pow(new BN(bits - 1)).subn(1);
|
||||
@ -148,17 +142,11 @@ contract('SafeCast', async function () {
|
||||
});
|
||||
|
||||
it(`reverts when casting INT256_MAX + 1 (${maxInt256.addn(1)})`, async function () {
|
||||
await expectRevert(
|
||||
this.safeCast.$toInt256(maxInt256.addn(1)),
|
||||
'SafeCast: value doesn\'t fit in an int256',
|
||||
);
|
||||
await expectRevert(this.safeCast.$toInt256(maxInt256.addn(1)), "SafeCast: value doesn't fit in an int256");
|
||||
});
|
||||
|
||||
it(`reverts when casting UINT256_MAX (${maxUint256})`, async function () {
|
||||
await expectRevert(
|
||||
this.safeCast.$toInt256(maxUint256),
|
||||
'SafeCast: value doesn\'t fit in an int256',
|
||||
);
|
||||
await expectRevert(this.safeCast.$toInt256(maxUint256), "SafeCast: value doesn't fit in an int256");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user