Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
fix (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
decanus committed Apr 2, 2020
1 parent f0cc3ff commit 1d96ae3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 55 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -29,7 +29,7 @@
"web3-utils": "^1.0.0-beta.31"
},
"devDependencies": {
"@ensdomains/test-utils": "^1.2.0",
"@ensdomains/test-utils": "1.3.0",
"solidity-coverage": "^0.3.5",
"solium": "^1.0.4",
"truffle": "5.0.19"
Expand Down
36 changes: 8 additions & 28 deletions test/TestENS.js
Expand Up @@ -30,13 +30,9 @@ contracts.forEach(function ([ENS, lang]) {
});

it('should prohibit transfers by non-owners', async () => {
try {
await ens.setOwner('0x1', '0x0000000000000000000000000000000000001234', {from: accounts[0]});
} catch (error) {
return exceptions.ensureException(error);
}

assert.fail('transfer did not fail');
await exceptions.expectFailure(
ens.setOwner('0x1', '0x0000000000000000000000000000000000001234', {from: accounts[0]})
);
});

it('should allow setting resolvers', async () => {
Expand All @@ -53,13 +49,9 @@ contracts.forEach(function ([ENS, lang]) {
});

it('should prevent setting resolvers by non-owners', async () => {
try {
await ens.setResolver('0x1', '0x0000000000000000000000000000000000001234', {from: accounts[0]});
} catch (error) {
return exceptions.ensureException(error);
}

assert.fail('setting resolver did not fail');
await exceptions.expectFailure(
ens.setResolver('0x1', '0x0000000000000000000000000000000000001234', {from: accounts[0]})
);
});

it('should allow setting the TTL', async () => {
Expand All @@ -74,13 +66,7 @@ contracts.forEach(function ([ENS, lang]) {
});

it('should prevent setting the TTL by non-owners', async () => {
try {
await ens.setTTL('0x1', 3600, {from: accounts[0]});
} catch (error) {
return exceptions.ensureException(error);
}

assert.fail('setting resolver did not fail');
await exceptions.expectFailure(ens.setTTL('0x1', 3600, {from: accounts[0]}));
});

it('should allow the creation of subnodes', async () => {
Expand All @@ -96,13 +82,7 @@ contracts.forEach(function ([ENS, lang]) {
});

it('should prohibit subnode creation by non-owners', async () => {
try {
await ens.setSubnodeOwner('0x0', sha3('eth'), accounts[1], {from: accounts[1]});
} catch (error) {
return exceptions.ensureException(error);
}

assert.fail('setting resolver did not fail');
await exceptions.expectFailure(ens.setSubnodeOwner('0x0', sha3('eth'), accounts[1], {from: accounts[1]}));
});
});
});
2 changes: 0 additions & 2 deletions test/TestENSRegistryWithFallback.js
@@ -1,8 +1,6 @@
const namehash = require('eth-ens-namehash');
const sha3 = require('web3-utils').sha3;

const { exceptions } = require("@ensdomains/test-utils")

const ENS = artifacts.require('ENSRegistryWithFallback.sol');

const ENSWithoutFallback = artifacts.require("ENSRegistry.sol");
Expand Down
8 changes: 1 addition & 7 deletions test/TestFIFSRegistrar.js
Expand Up @@ -34,13 +34,7 @@ contract('FIFSRegistrar', function (accounts) {
});

it('forbids transferring the name you do not own', async () => {
try {
await registrar.register(sha3('eth'), accounts[1], {from: accounts[1]});
} catch (error) {
return exceptions.ensureException(error);
}

assert.fail('transfer did not fail');
await exceptions.expectFailure(registrar.register(sha3('eth'), accounts[1], {from: accounts[1]}));
});
});
});
11 changes: 1 addition & 10 deletions test/TestTestRegistrar.js
Expand Up @@ -26,17 +26,8 @@ contract('TestRegistrar', function (accounts) {
});

it('forbids transferring names within the test period', async () => {

await registrar.register(sha3('eth'), accounts[1], {from: accounts[0]});

try {
await registrar.register(sha3('eth'), accounts[0], {from: accounts[0]});
} catch (error) {
return exceptions.ensureException(error);
}

assert.fail('transferring name did not fail');

await exceptions.expectFailure(registrar.register(sha3('eth'), accounts[0], {from: accounts[0]}));
});

it('allows claiming a name after the test period expires', async () => {
Expand Down

0 comments on commit 1d96ae3

Please sign in to comment.