difftreelog
test get rid of AccountId::default
in: master
5 files changed
tests/src/interfaces/augment-api-rpc.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-rpc.ts
+++ b/tests/src/interfaces/augment-api-rpc.ts
@@ -633,11 +633,11 @@
/**
* Get token owner
**/
- tokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<PalletEvmAccountBasicCrossAccountIdRepr>>;
+ tokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
/**
* Get token owner, in case of nested token - find parent recursive
**/
- topmostTokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<PalletEvmAccountBasicCrossAccountIdRepr>>;
+ topmostTokenOwner: AugmentedRpc<(collection: u32 | AnyNumber | Uint8Array, tokenId: u32 | AnyNumber | Uint8Array, at?: Hash | string | Uint8Array) => Observable<Option<PalletEvmAccountBasicCrossAccountIdRepr>>>;
/**
* Get token variable metadata
**/
tests/src/interfaces/unique/definitions.tsdiffbeforeafterboth--- a/tests/src/interfaces/unique/definitions.ts
+++ b/tests/src/interfaces/unique/definitions.ts
@@ -48,8 +48,8 @@
accountBalance: fun('Get amount of different user tokens', [collectionParam, crossAccountParam()], 'u32'),
balance: fun('Get amount of specific account token', [collectionParam, crossAccountParam(), tokenParam], 'u128'),
allowance: fun('Get allowed amount', [collectionParam, crossAccountParam('sender'), crossAccountParam('spender'), tokenParam], 'u128'),
- tokenOwner: fun('Get token owner', [collectionParam, tokenParam], CROSS_ACCOUNT_ID_TYPE),
- topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], CROSS_ACCOUNT_ID_TYPE),
+ tokenOwner: fun('Get token owner', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
+ topmostTokenOwner: fun('Get token owner, in case of nested token - find parent recursive', [collectionParam, tokenParam], `Option<${CROSS_ACCOUNT_ID_TYPE}>`),
constMetadata: fun('Get token constant metadata', [collectionParam, tokenParam], 'Vec<u8>'),
variableMetadata: fun('Get token variable metadata', [collectionParam, tokenParam], 'Vec<u8>'),
tokenExists: fun('Check if token exists', [collectionParam, tokenParam], 'bool'),
tests/src/nesting/nest.test.tsdiffbeforeafterboth--- a/tests/src/nesting/nest.test.ts
+++ b/tests/src/nesting/nest.test.ts
@@ -4,7 +4,7 @@
import usingApi from '../substrate/substrate-api';
import {createCollectionExpectSuccess, createItemExpectSuccess, getTokenOwner, getTopmostTokenOwner, setCollectionLimitsExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../util/helpers';
-describe.only('nesting', () => {
+describe('nesting', () => {
it('allows to nest/unnest token', async () => {
await usingApi(async api => {
const alice = privateKey('//Alice');
tests/src/rpc.test.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/rpc.test.ts
@@ -0,0 +1,12 @@
+import {expect} from 'chai';
+import usingApi from './substrate/substrate-api';
+import {createCollectionExpectSuccess, getTokenOwner} from './util/helpers';
+
+describe('getTokenOwner', () => {
+ it('returns None for fungible collection', async () => {
+ await usingApi(async api => {
+ const collection = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
+ await expect(getTokenOwner(api, collection, 0)).to.be.rejectedWith(/^owner == null$/);
+ });
+ });
+});
\ No newline at end of file
tests/src/util/helpers.tsdiffbeforeafterboth985 collectionId: number,985 collectionId: number,986 token: number,986 token: number,987): Promise<CrossAccountId> {987): Promise<CrossAccountId> {988 return normalizeAccountId((await api.rpc.unique.tokenOwner(collectionId, token)).toJSON() as any);988 const owner = (await api.rpc.unique.tokenOwner(collectionId, token)).toJSON() as any;989 if (owner == null) throw new Error('owner == null');990 return normalizeAccountId(owner);989}991}990export async function getTopmostTokenOwner(992export async function getTopmostTokenOwner(991 api: ApiPromise,993 api: ApiPromise,992 collectionId: number,994 collectionId: number,993 token: number,995 token: number,994): Promise<CrossAccountId> {996): Promise<CrossAccountId> {995 return normalizeAccountId((await api.rpc.unique.topmostTokenOwner(collectionId, token)).toJSON() as any);997 const owner = (await api.rpc.unique.topmostTokenOwner(collectionId, token)).toJSON() as any;998 if (owner == null) throw new Error('owner == null');999 return normalizeAccountId(owner);996}1000}997export async function isTokenExists(1001export async function isTokenExists(998 api: ApiPromise,1002 api: ApiPromise,