lint fix
This commit is contained in:
@@ -1,25 +1,28 @@
|
||||
const namehash = require('eth-ens-namehash').hash;
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
const Contributor = artifacts.require("Contributor.sol");
|
||||
|
||||
const getContract = name => artifacts.require(name)
|
||||
// eslint-disable-next-line no-undef
|
||||
const getContract = name => artifacts.require(name);
|
||||
const { assertRevert } = require('@aragon/test-helpers/assertThrow');
|
||||
|
||||
const ZERO_ADDR = '0x0000000000000000000000000000000000000000';
|
||||
|
||||
contract('Contributor app', (accounts) => {
|
||||
let kernelBase, aclBase, daoFactory, dao, acl, contributor;
|
||||
let kernelBase, aclBase, daoFactory, r, dao, acl, contributor;
|
||||
|
||||
const root = accounts[0];
|
||||
const member1 = accounts[1];
|
||||
|
||||
before(async() => {
|
||||
kernelBase = await getContract('Kernel').new(true) // petrify immediately
|
||||
aclBase = await getContract('ACL').new()
|
||||
// eslint-disable-next-line no-undef
|
||||
before(async () => {
|
||||
kernelBase = await getContract('Kernel').new(true); // petrify immediately
|
||||
aclBase = await getContract('ACL').new();
|
||||
daoFactory = await getContract('DAOFactory').new(kernelBase.address, aclBase.address, ZERO_ADDR);
|
||||
r = await daoFactory.newDAO(root)
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao)
|
||||
acl = getContract('ACL').at(await dao.acl())
|
||||
r = await daoFactory.newDAO(root);
|
||||
dao = getContract('Kernel').at(r.logs.filter(l => l.event == 'DeployDAO')[0].args.dao);
|
||||
acl = getContract('ACL').at(await dao.acl());
|
||||
|
||||
//create dao mamnager permission for coin owner
|
||||
await acl.createPermission(
|
||||
@@ -37,10 +40,10 @@ contract('Contributor app', (accounts) => {
|
||||
0x0,
|
||||
false,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
contributor = Contributor.at(
|
||||
receipt.logs.filter(l => l.event == 'NewAppProxy')[0].args.proxy
|
||||
)
|
||||
);
|
||||
|
||||
//apps id
|
||||
let appsId = [];
|
||||
@@ -59,47 +62,50 @@ contract('Contributor app', (accounts) => {
|
||||
await contributor.MANAGE_CONTRIBUTORS_ROLE(),
|
||||
root,
|
||||
{ from: root }
|
||||
)
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
describe("Owner default space permissions", async() => {
|
||||
it('check owner is token issuer', async() => {
|
||||
describe("Owner default space permissions", async () => {
|
||||
it('check owner is token issuer', async () => {
|
||||
let manageContributorPermission = await acl.hasPermission(root, contributor.address, await contributor.MANAGE_CONTRIBUTORS_ROLE());
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(manageContributorPermission, true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Add contributor", async() => {
|
||||
describe("Add contributor", async () => {
|
||||
let account = root;
|
||||
let hashDigest = '0x0';
|
||||
let hashFunction = 0;
|
||||
let hashSize = 0;
|
||||
|
||||
it("should revert when add contributor from an address that does not have permission", async() => {
|
||||
return assertRevert(async() => {
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize, { from: member1})
|
||||
'sender does not have permission'
|
||||
it("should revert when add contributor from an address that does not have permission", async () => {
|
||||
return assertRevert(async () => {
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize, { from: member1});
|
||||
'sender does not have permission';
|
||||
});
|
||||
});
|
||||
|
||||
it('add contributor', async() => {
|
||||
it('add contributor', async () => {
|
||||
let contributorCount = await contributor.coreContributorsCount();
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize);
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(await contributor.addressExists(account), true);
|
||||
let contributorCountAfter = await contributor.coreContributorsCount();
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(await contributorCountAfter.toNumber(), parseInt(contributorCount)+1);
|
||||
});
|
||||
|
||||
it("should revert when add contributor with an address that already exist", async() => {
|
||||
return assertRevert(async() => {
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize, { from: member1})
|
||||
'address already exist'
|
||||
it("should revert when add contributor with an address that already exist", async () => {
|
||||
return assertRevert(async () => {
|
||||
await contributor.addContributor(account, hashDigest, hashFunction, hashSize, { from: member1});
|
||||
'address already exist';
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Update contributor", async() => {
|
||||
describe("Update contributor", async () => {
|
||||
let id;
|
||||
let oldAccount;
|
||||
let newAccount;
|
||||
@@ -107,7 +113,8 @@ contract('Contributor app', (accounts) => {
|
||||
let hashFunction;
|
||||
let hashSize;
|
||||
|
||||
before(async() => {
|
||||
// eslint-disable-next-line no-undef
|
||||
before(async () => {
|
||||
id = await contributor.coreContributorsCount();
|
||||
oldAccount = root;
|
||||
newAccount = member1;
|
||||
@@ -116,47 +123,48 @@ contract('Contributor app', (accounts) => {
|
||||
hashSize = 1;
|
||||
});
|
||||
|
||||
it('update contributor account', async() => {
|
||||
it('update contributor account', async () => {
|
||||
await contributor.updateContributorAccount(id.toNumber(), oldAccount, newAccount);
|
||||
let contributorId = await contributor.getContributorIdByAddress(oldAccount);
|
||||
// eslint-disable-next-line no-undef
|
||||
assert.equal(contributorId.toNumber(), 0);
|
||||
});
|
||||
|
||||
it("should revert when update contributor account from address that does not have permission", async() => {
|
||||
return assertRevert(async() => {
|
||||
it("should revert when update contributor account from address that does not have permission", async () => {
|
||||
return assertRevert(async () => {
|
||||
await contributor.updateContributorAccount(id.toNumber(), oldAccount, newAccount, {from: member1});
|
||||
'sender does not have permission'
|
||||
'sender does not have permission';
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when update contributor account that does not exist", async() => {
|
||||
return assertRevert(async() => {
|
||||
it("should revert when update contributor account that does not exist", async () => {
|
||||
return assertRevert(async () => {
|
||||
await contributor.updateContributorAccount(id.toNumber(), accounts[3], newAccount);
|
||||
'contributor does not exist'
|
||||
'contributor does not exist';
|
||||
});
|
||||
});
|
||||
|
||||
it("should revert when update contributor account with address(0)", async() => {
|
||||
return assertRevert(async() => {
|
||||
it("should revert when update contributor account with address(0)", async () => {
|
||||
return assertRevert(async () => {
|
||||
await contributor.updateContributorAccount(id.toNumber(), oldAccount, ZERO_ADDR);
|
||||
'contributor does not exist'
|
||||
'contributor does not exist';
|
||||
});
|
||||
});
|
||||
|
||||
it('update contributor profile hash', async() => {
|
||||
it('update contributor profile hash', async () => {
|
||||
await contributor.updateContributorProfileHash(id.toNumber(), hashDigest, hashFunction, hashSize);
|
||||
let contributorProfile = await contributor.contributors(id.toNumber());
|
||||
assert.equal(hashDigest, contributorProfile[1]);
|
||||
assert.equal(hashFunction, contributorProfile[2].toNumber());
|
||||
assert.equal(hashSize, contributorProfile[3].toNumber());
|
||||
assert.equal(hashDigest, contributorProfile[1]); // eslint-disable-line no-undef
|
||||
assert.equal(hashFunction, contributorProfile[2].toNumber()); // eslint-disable-line no-undef
|
||||
assert.equal(hashSize, contributorProfile[3].toNumber()); // eslint-disable-line no-undef
|
||||
});
|
||||
|
||||
it("should revert when update contributor profile hash from address that does not have permission", async() => {
|
||||
return assertRevert(async() => {
|
||||
it("should revert when update contributor profile hash from address that does not have permission", async () => {
|
||||
return assertRevert(async () => {
|
||||
await contributor.updateContributorProfileHash(id.toNumber(), hashDigest, hashFunction, hashSize, {from: member1});
|
||||
'sender does not have permission'
|
||||
'sender does not have permission';
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user