git.delta.rocks / unique-network / refs/commits / cc9eeb2f3b2c

difftreelog

source

js-packages/tests/eth/helpersSmoke.test.ts1.8 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {expect, itEth, usingEthPlaygrounds} from './util/index.js';18import type {IKeyringPair} from '@polkadot/types/types';1920describe('Helpers sanity check', () => {21  let donor: IKeyringPair;2223  before(async function() {24    await usingEthPlaygrounds(async (_helper, privateKey) => {25      donor = await privateKey({url: import.meta.url});26    });27  });2829  itEth('Contract owner is recorded', async ({helper}) => {30    const owner = await helper.eth.createAccountWithBalance(donor);3132    const flipper = await helper.eth.deployFlipper(owner);3334    expect(await (await helper.ethNativeContract.contractHelpers(owner)).methods.contractOwner(flipper.options.address).call()).to.be.equal(owner);35  });3637  itEth('Flipper is working', async ({helper}) => {38    const owner = await helper.eth.createAccountWithBalance(donor);3940    const flipper = await helper.eth.deployFlipper(owner);4142    expect(await flipper.methods.getValue().call()).to.be.false;43    await flipper.methods.flip().send({from: owner});44    expect(await flipper.methods.getValue().call()).to.be.true;45  });46});