difftreelog
setSchema test scenarios
in: master
4 files changed
tests/package.jsondiffbeforeafterboth--- a/tests/package.json
+++ b/tests/package.json
@@ -17,7 +17,10 @@
},
"scripts": {
"test": "mocha --timeout 9999999 -r ts-node/register ./**/*.test.ts",
- "load": "mocha --timeout 9999999 -r ts-node/register ./**/*.load.ts"
+ "load": "mocha --timeout 9999999 -r ts-node/register ./**/*.load.ts",
+ "testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",
+ "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",
+ "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts"
},
"author": "",
"license": "Apache 2.0",
tests/src/setSchemaVersion.test.tsdiffbeforeafterboth1import { BigNumber } from 'bignumber.js';2import chai from 'chai';3import chaiAsPromised from 'chai-as-promised';4import usingApi, { submitTransactionAsync } from './substrate/substrate-api';56chai.use(chaiAsPromised);7const expect = chai.expect;89describe('setSchemaVersion positive', () => {10 it('execute setSchemaVersion with image url and unique json ', async () => {11 await usingApi(async api => {1213 });14 });1516 it('validate schema version with just entered data', async () => {17 await usingApi(async api => {1819 });20 });21});2223describe('setSchemaVersion negative', () => {24 it('execute setSchemaVersion for not exists collection', async () => {25 await usingApi(async api => {2627 });28 });2930 it('execute setSchemaVersion for deleted collection', async () => {31 await usingApi(async api => {3233 });34 });3536 it('execute setSchemaVersion with not correct image url', async () => {37 await usingApi(async api => {3839 });40 });4142 it('execute setSchemaVersion with not correct unique', async () => {43 await usingApi(async api => {4445 });46 });47});tests/src/types.tsdiffbeforeafterboth--- /dev/null
+++ b/tests/src/types.ts
@@ -0,0 +1,23 @@
+import BN from 'bn.js';
+
+export interface ICollectionInterface {
+ Access: string;
+ id: number;
+ DecimalPoints: BN;
+ // constOnChainSchema
+ Description: [BN, BN]; // utf16
+ isReFungible: boolean;
+ MintMode: boolean;
+ Mode: {
+ Nft: null;
+ };
+ Name: [BN, BN]; // utf16
+ OffchainSchema: [Uint8Array];
+ SchemaVersion: string;
+ Owner: [Uint8Array];
+ // prefix
+ // sponsor
+ // tokenPrefix
+ // unconfirmedSponsor
+ // variableOnChainSchema
+}
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -47,7 +47,7 @@
return result;
}
-function getCreateCollectionResult(events: EventRecord[]): CreateCollectionResult {
+export function getCreateCollectionResult(events: EventRecord[]): CreateCollectionResult {
let success = false;
let collectionId: number = 0;
events.forEach(({ phase, event: { data, method, section } }) => {
@@ -65,7 +65,7 @@
return result;
}
-function getCreateItemResult(events: EventRecord[]): CreateItemResult {
+export function getCreateItemResult(events: EventRecord[]): CreateItemResult {
let success = false;
let collectionId: number = 0;
let itemId: number = 0;