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

Commit

Permalink
test disable currencies for simple policy creation
Browse files Browse the repository at this point in the history
  • Loading branch information
amarinkovic committed Mar 7, 2022
1 parent 95b85d2 commit 32d6d9a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions contracts/EntitySimplePolicyDataFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ contract EntitySimplePolicyDataFacet is EntityFacetBase, IDiamondFacet, IEntityS
IEntitySimplePolicyDataFacet.getSimplePolicyId.selector,
IEntitySimplePolicyDataFacet.getPremiumsAndClaimsPaid.selector,
IEntitySimplePolicyDataFacet.getEnabledCurrency.selector,
IEntitySimplePolicyDataFacet.getEnabledCurrencies.selector,
IEntitySimplePolicyDataFacet.updateEnabledCurrency.selector,
IEntitySimplePolicyDataFacet.paySimpleClaim.selector
);
Expand Down
17 changes: 16 additions & 1 deletion test/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ensureEntityDeployerIsDeployed } from '../deploy/modules/entityDeployer
import { ensureEntityImplementationsAreDeployed } from '../deploy/modules/entityImplementations'
import { ensurePolicyImplementationsAreDeployed } from '../deploy/modules/policyImplementations'
import { getAccounts } from '../deploy/utils'
import { expect } from 'chai'

const IEntity = artifacts.require("base/IEntity")
const Proxy = artifacts.require('base/Proxy')
Expand Down Expand Up @@ -876,6 +877,7 @@ describe('Entity', () => {
})

it('by anyone', async () => {
await entity.allowPolicy().should.eventually.eq(true)
await createPolicy(entity, {}, { from: accounts[9] }).should.be.fulfilled
})

Expand Down Expand Up @@ -1041,7 +1043,7 @@ describe('Entity', () => {
unit = etherToken.address

})

describe('can be created if', () => {

it('creation is enabled on entity', async () => {
Expand Down Expand Up @@ -1242,6 +1244,19 @@ describe('Entity', () => {

})
})

it('currency can be disabled', async () => {
await entity.updateEnabledCurrency(unit, 500, 100, { from: systemManager })

const currencies = await entity.getEnabledCurrencies()
expect(currencies).to.have.members([ unit ])

await entity.updateEnabledCurrency(unit, 0, 0, { from: systemManager })

const currencies2 = await entity.getEnabledCurrencies()
expect(currencies2).to.not.have.members([ unit ])
})

})
})
})

0 comments on commit 32d6d9a

Please sign in to comment.