From 7020b679438fcad678c064e2c63c51def9ad3061 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Mon, 14 May 2018 17:58:42 -0300 Subject: [PATCH] rename ens testscript --- test/{testens.js => ensregistry.js} | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) rename test/{testens.js => ensregistry.js} (59%) diff --git a/test/testens.js b/test/ensregistry.js similarity index 59% rename from test/testens.js rename to test/ensregistry.js index c929584..ed85f03 100644 --- a/test/testens.js +++ b/test/ensregistry.js @@ -1,7 +1,7 @@ const utils = require('../utils/testUtils.js'); const web3Utils = require('web3-utils'); const namehash = require('eth-ens-namehash'); -const nodeZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; +const utils.zeroBytes32 = "0x0000000000000000000000000000000000000000000000000000000000000000"; contract('ENS', function () { let ens; @@ -20,15 +20,15 @@ contract('ENS', function () { }); it('should allow ownership transfers', async () => { - let result = await ens.methods.setOwner(nodeZero, accountsArr[1]).send({from: accountsArr[0]}); - assert.equal(await ens.methods.owner(nodeZero).call(), accountsArr[1]) - assert.equal(result.events.Transfer.returnValues.node, nodeZero); + let result = await ens.methods.setOwner(utils.zeroBytes32, accountsArr[1]).send({from: accountsArr[0]}); + assert.equal(await ens.methods.owner(utils.zeroBytes32).call(), accountsArr[1]) + assert.equal(result.events.Transfer.returnValues.node, utils.zeroBytes32); assert.equal(result.events.Transfer.returnValues.owner, accountsArr[1]); }); it('should prohibit transfers by non-owners', async () => { try { - await ens.methods.setOwner(nodeZero, accountsArr[2]).send({from: accountsArr[0]}); + await ens.methods.setOwner(utils.zeroBytes32, accountsArr[2]).send({from: accountsArr[0]}); } catch (error) { return utils.ensureException(error); } @@ -37,16 +37,16 @@ contract('ENS', function () { }); it('should allow setting resolvers', async () => { - let result = await ens.methods.setResolver(nodeZero, accountsArr[3]).send({from: accountsArr[1]}); + let result = await ens.methods.setResolver(utils.zeroBytes32, accountsArr[3]).send({from: accountsArr[1]}); let args = result.events.NewResolver.returnValues; - assert.equal(args.node, nodeZero); + assert.equal(args.node, utils.zeroBytes32); assert.equal(args.resolver, accountsArr[3]); - assert.equal(await ens.methods.resolver(nodeZero).call(), accountsArr[3]); + assert.equal(await ens.methods.resolver(utils.zeroBytes32).call(), accountsArr[3]); }); it('should prevent setting resolvers by non-owners', async () => { try { - await ens.methods.setResolver(nodeZero, accountsArr[4]).send({from: accountsArr[0]}); + await ens.methods.setResolver(utils.zeroBytes32, accountsArr[4]).send({from: accountsArr[0]}); } catch (error) { return utils.ensureException(error); } @@ -55,16 +55,16 @@ contract('ENS', function () { }); it('should allow setting the TTL', async () => { - let result = await ens.methods.setTTL(nodeZero, 3600).send({from: accountsArr[1]}); - assert.equal(await ens.methods.ttl(nodeZero).call(), 3600); + let result = await ens.methods.setTTL(utils.zeroBytes32, 3600).send({from: accountsArr[1]}); + assert.equal(await ens.methods.ttl(utils.zeroBytes32).call(), 3600); let args = result.events.NewTTL.returnValues; - assert.equal(args.node, nodeZero); + assert.equal(args.node, utils.zeroBytes32); assert.equal(args.ttl, 3600); }); it('should prevent setting the TTL by non-owners', async () => { try { - await ens.methods.setTTL(nodeZero, 1200).send({from: accountsArr[0]}); + await ens.methods.setTTL(utils.zeroBytes32, 1200).send({from: accountsArr[0]}); } catch (error) { return utils.ensureException(error); } @@ -73,17 +73,17 @@ contract('ENS', function () { }); it('should allow the creation of subnodes', async () => { - let result = await ens.methods.setSubnodeOwner(nodeZero, web3Utils.sha3('eth'), accountsArr[2]).send({from: accountsArr[1]}); + let result = await ens.methods.setSubnodeOwner(utils.zeroBytes32, web3Utils.sha3('eth'), accountsArr[2]).send({from: accountsArr[1]}); assert.equal(await ens.methods.owner(namehash.hash('eth')).call(), accountsArr[2]); let args = result.events.NewOwner.returnValues; - assert.equal(args.node, nodeZero); + assert.equal(args.node, utils.zeroBytes32); assert.equal(args.label, web3Utils.sha3('eth')); assert.equal(args.owner, accountsArr[2]); }); it('should prohibit subnode creation by non-owners', async () => { try { - await ens.methods.setSubnodeOwner(nodeZero, web3Utils.sha3('eth'), accountsArr[3]).send({from: accountsArr[0]}); + await ens.methods.setSubnodeOwner(utils.zeroBytes32, web3Utils.sha3('eth'), accountsArr[3]).send({from: accountsArr[0]}); } catch (error) { return utils.ensureException(error); }