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

difftreelog

fix for test helpers

Grigoriy Simonov2022-06-24parent: #2986834.patch.diff
in: master

1 file changed

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
834approve(834approve(
835 api: ApiPromise,835 api: ApiPromise,
836 collectionId: number,836 collectionId: number,
837 tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string | IKeyringPair, amount: number | bigint = 1,837 tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string | IKeyringPair, amount: number | bigint,
838) {838) {
839 const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);839 const approveUniqueTx = api.tx.unique.approve(normalizeAccountId(approved), collectionId, tokenId, amount);
840 const events = await submitTransactionAsync(owner, approveUniqueTx);840 const events = await submitTransactionAsync(owner, approveUniqueTx);
847 tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string, amount: number | bigint = 1,847 tokenId: number, owner: IKeyringPair, approved: CrossAccountId | string, amount: number | bigint = 1,
848) {848) {
849 await usingApi(async (api: ApiPromise) => {849 await usingApi(async (api: ApiPromise) => {
850 const result = approve(api, collectionId, tokenId, owner, approved);850 const result = await approve(api, collectionId, tokenId, owner, approved, amount);
851 expect(result).to.be.true;851 expect(result).to.be.true;
852852
853 expect(await getAllowance(api, collectionId, owner.address, approved, tokenId)).to.be.equal(BigInt(amount));853 expect(await getAllowance(api, collectionId, owner, approved, tokenId)).to.be.equal(BigInt(amount));
854 });854 });
855}855}
856856
902 if (type === 'Fungible' || type === 'ReFungible') {902 if (type === 'Fungible' || type === 'ReFungible') {
903 balanceBefore = await getBalance(api, collectionId, to, tokenId);903 balanceBefore = await getBalance(api, collectionId, to, tokenId);
904 }904 }
905 expect(transferFrom(api, collectionId, tokenId, accountApproved, accountFrom, accountTo, value)).to.be.true;905 expect(await transferFrom(api, collectionId, tokenId, accountApproved, accountFrom, accountTo, value)).to.be.true;
906 if (type === 'NFT') {906 if (type === 'NFT') {
907 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(to);907 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal(to);
908 }908 }