1234567891011121314151617import usingApi from '../substrate/substrate-api';18import {deployFlipper, toggleFlipValueExpectFailure, toggleFlipValueExpectSuccess} from '../deprecated-helpers/contracthelpers';19import {addToContractAllowListExpectSuccess, isAllowlistedInContract, removeFromContractAllowListExpectFailure, removeFromContractAllowListExpectSuccess, toggleContractAllowlistExpectSuccess} from '../deprecated-helpers/helpers';20import {IKeyringPair} from '@polkadot/types/types';21import {expect} from 'chai';222324describe.skip('Integration Test removeFromContractAllowList', () => {25 let bob: IKeyringPair;2627 before(async () => {28 await usingApi(async (api, privateKeyWrapper) => {29 bob = privateKeyWrapper('//Bob');30 });31 });3233 it('user is no longer allowlisted after removal', async () => {34 await usingApi(async (api, privateKeyWrapper) => {35 const [flipper, deployer] = await deployFlipper(api, privateKeyWrapper);3637 await addToContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);38 await removeFromContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);3940 expect(await isAllowlistedInContract(flipper.address, bob.address)).to.be.false;41 });42 });4344 it('user can\'t execute contract after removal', async () => {45 await usingApi(async (api, privateKeyWrapper) => {46 const [flipper, deployer] = await deployFlipper(api, privateKeyWrapper);47 await toggleContractAllowlistExpectSuccess(deployer, flipper.address.toString(), true);4849 await addToContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);50 await toggleFlipValueExpectSuccess(bob, flipper);5152 await removeFromContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);53 await toggleFlipValueExpectFailure(bob, flipper);54 });55 });5657 it('can be called twice', async () => {58 await usingApi(async (api, privateKeyWrapper) => {59 const [flipper, deployer] = await deployFlipper(api, privateKeyWrapper);6061 await addToContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);62 await removeFromContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);63 await removeFromContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);64 });65 });66});6768describe.skip('Negative Integration Test removeFromContractAllowList', () => {69 let alice: IKeyringPair;70 let bob: IKeyringPair;7172 before(async () => {73 await usingApi(async (api, privateKeyWrapper) => {74 alice = privateKeyWrapper('//Alice');75 bob = privateKeyWrapper('//Bob');76 });77 });7879 it('fails when called with non-contract address', async () => {80 await usingApi(async () => {81 await removeFromContractAllowListExpectFailure(alice, alice.address, bob.address);82 });83 });8485 it('fails when executed by non owner', async () => {86 await usingApi(async (api, privateKeyWrapper) => {87 const [flipper] = await deployFlipper(api, privateKeyWrapper);8889 await removeFromContractAllowListExpectFailure(alice, flipper.address.toString(), bob.address);90 });91 });92});