difftreelog
test nested rft topMostOwner
in: master
1 file changed
tests/src/nesting/nest.test.tsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617import {IKeyringPair} from '@polkadot/types/types';17import {IKeyringPair} from '@polkadot/types/types';18import {expect, itSub, usingPlaygrounds} from '../util';18import {expect, itSub, Pallets, usingPlaygrounds} from '../util';191920describe('Integration Test: Composite nesting tests', () => {20describe('Integration Test: Composite nesting tests', () => {21 let alice: IKeyringPair;21 let alice: IKeyringPair;138 before(async () => {138 before(async () => {139 await usingPlaygrounds(async (helper, privateKey) => {139 await usingPlaygrounds(async (helper, privateKey) => {140 const donor = await privateKey({filename: __filename});140 const donor = await privateKey({filename: __filename});141 [alice, bob, charlie] = await helper.arrange.createAccounts([50n, 10n, 10n], donor);141 [alice, bob, charlie] = await helper.arrange.createAccounts([200n, 10n, 10n], donor);142 });142 });143 });143 });144144289 expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(7n);289 expect(await collectionFT.getBalance(targetToken.nestingAccount())).to.be.equal(7n);290 });290 });291292 itSub.ifWithPallets('ReFungible: getTopmostOwner works correctly with Nesting', [Pallets.ReFungible], async({helper}) => {293 const collectionNFT = await helper.nft.mintCollection(alice, {294 permissions: {295 nesting: {296 tokenOwner: true,297 },298 },299 });300 const collectionRFT = await helper.rft.mintCollection(alice);301302 const nft = await collectionNFT.mintToken(alice, {Substrate: alice.address});303 const rft = await collectionRFT.mintToken(alice, 100n, {Substrate: alice.address});304305 expect(await rft.getTopmostOwner()).deep.equal({Substrate: alice.address});306307 await rft.transfer(alice, nft.nestingAccount(), 40n);308309 expect(await rft.getTopmostOwner()).deep.equal(null);310311 await rft.transfer(alice, nft.nestingAccount(), 60n);312313 expect(await rft.getTopmostOwner()).deep.equal({Substrate: alice.address});314315 await rft.transferFrom(alice, nft.nestingAccount(), {Substrate: alice.address}, 30n);316317 expect(await rft.getTopmostOwner()).deep.equal(null);318319 await rft.transferFrom(alice, nft.nestingAccount(), {Substrate: alice.address}, 70n);320321 expect(await rft.getTopmostOwner()).deep.equal({Substrate: alice.address});322 });291});323});292324293describe('Negative Test: Nesting', () => {325describe('Negative Test: Nesting', () => {