1234567891011121314151617import usingApi from './substrate/substrate-api';18import {deployFlipper, toggleFlipValueExpectFailure, toggleFlipValueExpectSuccess} from './util/contracthelpers';19import {addToContractAllowListExpectSuccess, isAllowlistedInContract, removeFromContractAllowListExpectFailure, removeFromContractAllowListExpectSuccess, toggleContractAllowlistExpectSuccess} from './util/helpers';20import {IKeyringPair} from '@polkadot/types/types';21import {expect} from 'chai';2223describe.skip('Integration Test removeFromContractAllowList', () => {24 let bob: IKeyringPair;2526 before(async () => {27 await usingApi(async (api, privateKeyWrapper) => {28 bob = privateKeyWrapper('//Bob');29 });30 });3132 it('user is no longer allowlisted after removal', async () => {33 await usingApi(async (api, privateKeyWrapper) => {34 const [flipper, deployer] = await deployFlipper(api, privateKeyWrapper);3536 await addToContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);37 await removeFromContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);3839 expect(await isAllowlistedInContract(flipper.address, bob.address)).to.be.false;40 });41 });4243 it('user can\'t execute contract after removal', async () => {44 await usingApi(async (api, privateKeyWrapper) => {45 const [flipper, deployer] = await deployFlipper(api, privateKeyWrapper);46 await toggleContractAllowlistExpectSuccess(deployer, flipper.address.toString(), true);4748 await addToContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);49 await toggleFlipValueExpectSuccess(bob, flipper);5051 await removeFromContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);52 await toggleFlipValueExpectFailure(bob, flipper);53 });54 });5556 it('can be called twice', async () => {57 await usingApi(async (api, privateKeyWrapper) => {58 const [flipper, deployer] = await deployFlipper(api, privateKeyWrapper);5960 await addToContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);61 await removeFromContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);62 await removeFromContractAllowListExpectSuccess(deployer, flipper.address.toString(), bob.address);63 });64 });65});6667describe.skip('Negative Integration Test removeFromContractAllowList', () => {68 let alice: IKeyringPair;69 let bob: IKeyringPair;7071 before(async () => {72 await usingApi(async (api, privateKeyWrapper) => {73 alice = privateKeyWrapper('//Alice');74 bob = privateKeyWrapper('//Bob');75 });76 });7778 it('fails when called with non-contract address', async () => {79 await usingApi(async () => {80 await removeFromContractAllowListExpectFailure(alice, alice.address, bob.address);81 });82 });8384 it('fails when executed by non owner', async () => {85 await usingApi(async (api, privateKeyWrapper) => {86 const [flipper] = await deployFlipper(api, privateKeyWrapper);8788 await removeFromContractAllowListExpectFailure(alice, flipper.address.toString(), bob.address);89 });90 });91});