git.delta.rocks / unique-network / refs/commits / 5de8270bcd75

difftreelog

source

tests/src/sub/nesting/refungible.test.ts2.2 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 {IKeyringPair} from '@polkadot/types/types';18import {expect, itSub, Pallets, usingPlaygrounds} from '../../util';1920// ReFungible specific nesting tests21let alice: IKeyringPair;2223before(async () => {24  await usingPlaygrounds(async (helper, privateKey) => {25    const donor = await privateKey({url: import.meta.url});26    [alice] = await helper.arrange.createAccounts([200n], donor);27  });28});2930itSub.ifWithPallets('ReFungible: getTopmostOwner works correctly with Nesting', [Pallets.ReFungible], async({helper}) => {31  const collectionNFT = await helper.nft.mintCollection(alice, {32    permissions: {33      nesting: {34        tokenOwner: true,35      },36    },37  });38  const collectionRFT = await helper.rft.mintCollection(alice);3940  const nft = await collectionNFT.mintToken(alice, {Substrate: alice.address});41  const rft = await collectionRFT.mintToken(alice, 100n, {Substrate: alice.address});4243  expect(await rft.getTopmostOwner()).deep.equal({Substrate: alice.address});4445  await rft.transfer(alice, nft.nestingAccount(), 40n);4647  expect(await rft.getTopmostOwner()).deep.equal(null);4849  await rft.transfer(alice, nft.nestingAccount(), 60n);5051  expect(await rft.getTopmostOwner()).deep.equal({Substrate: alice.address});5253  await rft.transferFrom(alice, nft.nestingAccount(), {Substrate: alice.address}, 30n);5455  expect(await rft.getTopmostOwner()).deep.equal(null);5657  await rft.transferFrom(alice, nft.nestingAccount(), {Substrate: alice.address}, 70n);5859  expect(await rft.getTopmostOwner()).deep.equal({Substrate: alice.address});60});