Skip to content

Commit

Permalink
test: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nachomazzara committed Apr 23, 2019
1 parent 80c4205 commit 4a73f7a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/EstateRegistry.js
Expand Up @@ -1240,13 +1240,27 @@ contract('EstateRegistry', accounts => {
})

it('reverts if not owner or approvedForAll set updateManager', async function() {
// Not owner
await assertRevert(
estate.setUpdateManager(user, operator, true, sentByAnotherUser)
)

// Hacker
await assertRevert(
estate.setUpdateManager(user, operator, true, sentByHacker)
)

// Operator
await estate.approve(operator, 1, sentByUser)
await assertRevert(
estate.setUpdateManager(user, operator, true, sentByOperator)
)

// Update Operator
await estate.setUpdateOperator(1, anotherUser, sentByUser)
await assertRevert(
estate.setUpdateManager(user, operator, true, sentByAnotherUser)
)
})

it('reverts when updateManager trying to transfer', async function() {
Expand Down
14 changes: 14 additions & 0 deletions test/LANDRegistry.js
Expand Up @@ -1048,13 +1048,27 @@ contract('LANDRegistry', accounts => {
})

it('reverts if not owner or approvedForAll set updateManager', async function() {
// Not owner
await assertRevert(
land.setUpdateManager(user, operator, true, sentByAnotherUser)
)

// Hacker
await assertRevert(
land.setUpdateManager(user, operator, true, sentByHacker)
)

// Operator
await land.approve(operator, 1, sentByUser)
await assertRevert(
land.setUpdateManager(user, operator, true, sentByOperator)
)

// Update Operator
await land.setUpdateOperator(1, anotherUser, sentByUser)
await assertRevert(
land.setUpdateManager(user, operator, true, sentByAnotherUser)
)
})

it('reverts when updateManager trying to transfer', async function() {
Expand Down

0 comments on commit 4a73f7a

Please sign in to comment.