From c980d88081dd4bb3861fd3282ea599d99d13cea6 Mon Sep 17 00:00:00 2001 From: kpozdnikin Date: Wed, 13 Jan 2021 12:41:28 +0000 Subject: [PATCH] approve and transferFrom test scenarios --- --- /dev/null +++ b/tests/src/approve.test.ts @@ -0,0 +1,60 @@ +// +// This file is subject to the terms and conditions defined in +// file 'LICENSE', which is part of this source code package. +// +import { ApiPromise } from '@polkadot/api'; +import BN from 'bn.js'; +import chai from 'chai'; +import chaiAsPromised from 'chai-as-promised'; +import privateKey from './substrate/privateKey'; +import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api'; +import {createCollectionExpectSuccess, destroyCollectionExpectSuccess} from './util/helpers'; + +chai.use(chaiAsPromised); +const expect = chai.expect; + +interface ITokenDataType { + Owner: number[]; + ConstData: number[]; + VariableData: number[]; +} + +describe('Integration Test approve(spender, collection_id, item_id, amount):', () => { + it('Execute the extrinsic and check approvedList', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); +}); + +describe('Negative Integration Test approve(spender, collection_id, item_id, amount):', () => { + it('Approve for a collection that does not exist', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('Approve for a collection that was destroyed', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('Approve transfer of a token that does not exist', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('Approve using the address that does not own the approved token', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('Remove approval by using 0 amount', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); +}); --- /dev/null +++ b/tests/src/transferFrom.test.ts @@ -0,0 +1,72 @@ +// +// This file is subject to the terms and conditions defined in +// file 'LICENSE', which is part of this source code package. +// +import { ApiPromise } from '@polkadot/api'; +import BN from 'bn.js'; +import chai from 'chai'; +import chaiAsPromised from 'chai-as-promised'; +import privateKey from './substrate/privateKey'; +import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api'; +import {createCollectionExpectSuccess, destroyCollectionExpectSuccess} from './util/helpers'; + +chai.use(chaiAsPromised); +const expect = chai.expect; + +interface ITokenDataType { + Owner: number[]; + ConstData: number[]; + VariableData: number[]; +} + +describe('Integration Test transferFrom(from, recipient, collection_id, item_id, value):', () => { + it('Execute the extrinsic and check nftItemList - owner of toren', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); +}); + +describe('Negative Integration Test transferFrom(from, recipient, collection_id, item_id, value):', () => { + it('transferFrom for a collection that does not exist', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('transferFrom for a collection that was destroyed', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('transferFrom a token that does not exist', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('transferFrom a token that was deleted', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('transferFrom for not approved address', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('transferFrom incorrect token count', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); + + it('execute transferFrom from account that is not owner of collection', async () => { + await usingApi(async (api: ApiPromise) => { + + }); + }); +}); -- gitstuff