git.delta.rocks / unique-network / refs/commits / 27800fedbaa6

difftreelog

revert(test) unneeded test additions

Fahrrader2022-05-25parent: #ac4c4db.patch.diff
in: master

2 files changed

modifiedtests/package.jsondiffbeforeafterboth
before · tests/package.json
1{2  "name": "unique-tests",3  "version": "1.0.0",4  "description": "Unique Chain Tests",5  "main": "",6  "devDependencies": {7    "@polkadot/dev": "0.66.21",8    "@polkadot/ts": "0.4.22",9    "@polkadot/typegen": "8.3.3-12",10    "@types/chai": "^4.3.1",11    "@types/chai-as-promised": "^7.1.5",12    "@types/mocha": "^9.1.1",13    "@types/node": "^17.0.31",14    "@typescript-eslint/eslint-plugin": "^5.22.0",15    "@typescript-eslint/parser": "^5.22.0",16    "chai": "^4.3.6",17    "eslint": "^8.14.0",18    "mocha": "^10.0.0",19    "ts-node": "^10.7.0",20    "typescript": "^4.6.4"21  },22  "mocha": {23    "timeout": 9999999,24    "require": "ts-node/register"25  },26  "scripts": {27    "lint": "eslint --ext .ts,.js src/",28    "fix": "eslint --ext .ts,.js src/ --fix",29    "test": "mocha --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",30    "testEth": "mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.test.ts'",31    "testEthMarketplace": "mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.test.ts'",32    "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",33    "loadTransfer": "ts-node src/transfer.nload.ts",34    "testCollision": "mocha --timeout 9999999 -r ts-node/register ./src/collision-tests/*.test.ts",35    "testEvent": "mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.test.ts",36    "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",37    "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",38    "testStructure": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/**.test.ts",39    "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts",40    "testGraphs": "mocha --timeout 9999999 -r ts-node/register ./**/graphs.test.ts",41    "testMigrationStructure": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",42    "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",43    "testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",44    "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",45    "testSetCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionSponsor.test.ts",46    "testConfirmSponsorship": "mocha --timeout 9999999 -r ts-node/register ./**/confirmSponsorship.test.ts",47    "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",48    "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",49    "testRemoveFromAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromAllowList.test.ts",50    "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",51    "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",52    "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",53    "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",54    "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",55    "testCreateMultipleItemsEx": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItemsEx.test.ts",56    "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",57    "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",58    "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",59    "testToggleContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractAllowList.test.ts",60    "testAddToContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractAllowList.test.ts",61    "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",62    "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts",63    "testSetMintPermission": "mocha --timeout 9999999 -r ts-node/register ./**/setMintPermission.test.ts",64    "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.test.ts",65    "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",66    "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",67    "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",68    "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",69    "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",70    "testSetVariableMetadataSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setVariableMetadataSponsoringRateLimit.test.ts",71    "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.test.ts",72    "testXcmTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/xcmTransfer.test.ts",73    "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",74    "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",75    "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",76    "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",77    "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",78    "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",79    "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",80    "polkadot-types": "yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"81  },82  "author": "",83  "license": "SEE LICENSE IN ../LICENSE",84  "homepage": "",85  "dependencies": {86    "@polkadot/api": "8.3.3-12",87    "@polkadot/api-contract": "8.3.3-12",88    "@polkadot/util-crypto": "9.1.2-11",89    "bignumber.js": "^9.0.2",90    "chai-as-promised": "^7.1.1",91    "find-process": "^1.4.7",92    "solc": "^0.8.13",93    "web3": "^1.7.3"94  },95  "standard": {96    "globals": [97      "it",98      "assert",99      "beforeEach",100      "afterEach",101      "describe",102      "contract",103      "artifacts"104    ]105  },106  "resolutions": {107    "simple-get": "^4.0.1"108  }109}
after · tests/package.json
1{2  "name": "unique-tests",3  "version": "1.0.0",4  "description": "Unique Chain Tests",5  "main": "",6  "devDependencies": {7    "@polkadot/dev": "0.66.21",8    "@polkadot/ts": "0.4.22",9    "@polkadot/typegen": "8.3.3-12",10    "@types/chai": "^4.3.1",11    "@types/chai-as-promised": "^7.1.5",12    "@types/mocha": "^9.1.1",13    "@types/node": "^17.0.31",14    "@typescript-eslint/eslint-plugin": "^5.22.0",15    "@typescript-eslint/parser": "^5.22.0",16    "chai": "^4.3.6",17    "eslint": "^8.14.0",18    "mocha": "^10.0.0",19    "ts-node": "^10.7.0",20    "typescript": "^4.6.4"21  },22  "mocha": {23    "timeout": 9999999,24    "require": "ts-node/register"25  },26  "scripts": {27    "lint": "eslint --ext .ts,.js src/",28    "fix": "eslint --ext .ts,.js src/ --fix",29    "test": "mocha --timeout 9999999 -r ts-node/register './src/**/*.test.ts'",30    "testEth": "mocha --timeout 9999999 -r ts-node/register './**/eth/**/*.test.ts'",31    "testEthMarketplace": "mocha --timeout 9999999 -r ts-node/register './**/eth/marketplace/**/*.test.ts'",32    "load": "mocha --timeout 9999999 -r ts-node/register './**/*.load.ts'",33    "loadTransfer": "ts-node src/transfer.nload.ts",34    "testCollision": "mocha --timeout 9999999 -r ts-node/register ./src/collision-tests/*.test.ts",35    "testEvent": "mocha --timeout 9999999 -r ts-node/register ./src/check-event/*.test.ts",36    "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",37    "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",38    "testStructure": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/**.test.ts",39    "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts",40    "testMigrationStructure": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",41    "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",42    "testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",43    "testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",44    "testSetCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionSponsor.test.ts",45    "testConfirmSponsorship": "mocha --timeout 9999999 -r ts-node/register ./**/confirmSponsorship.test.ts",46    "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",47    "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",48    "testRemoveFromAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromAllowList.test.ts",49    "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",50    "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",51    "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",52    "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",53    "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",54    "testCreateMultipleItemsEx": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItemsEx.test.ts",55    "testApprove": "mocha --timeout 9999999 -r ts-node/register ./**/approve.test.ts",56    "testTransferFrom": "mocha --timeout 9999999 -r ts-node/register ./**/transferFrom.test.ts",57    "testCreateCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",58    "testToggleContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/toggleContractAllowList.test.ts",59    "testAddToContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/addToContractAllowList.test.ts",60    "testTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/transfer.test.ts",61    "testBurnItem": "mocha --timeout 9999999 -r ts-node/register ./**/burnItem.test.ts",62    "testSetMintPermission": "mocha --timeout 9999999 -r ts-node/register ./**/setMintPermission.test.ts",63    "testCreditFeesToTreasury": "mocha --timeout 9999999 -r ts-node/register ./**/creditFeesToTreasury.test.ts",64    "testEnableContractSponsoring": "mocha --timeout 9999999 -r ts-node/register ./**/enableContractSponsoring.test.ts",65    "testRemoveFromContractAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromContractAllowList.test.ts",66    "testSetContractSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setContractSponsoringRateLimit.test.ts",67    "testSetOffchainSchema": "mocha --timeout 9999999 -r ts-node/register ./**/setOffchainSchema.test.ts",68    "testOverflow": "mocha --timeout 9999999 -r ts-node/register ./**/overflow.test.ts",69    "testSetVariableMetadataSponsoringRateLimit": "mocha --timeout 9999999 -r ts-node/register ./**/setVariableMetadataSponsoringRateLimit.test.ts",70    "testInflation": "mocha --timeout 9999999 -r ts-node/register ./**/inflation.test.ts",71    "testXcmTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/xcmTransfer.test.ts",72    "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",73    "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",74    "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",75    "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",76    "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",77    "polkadot-types-from-defs": "ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",78    "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",79    "polkadot-types": "yarn polkadot-types-fetch-metadata && yarn polkadot-types-from-defs && yarn polkadot-types-from-chain"80  },81  "author": "",82  "license": "SEE LICENSE IN ../LICENSE",83  "homepage": "",84  "dependencies": {85    "@polkadot/api": "8.3.3-12",86    "@polkadot/api-contract": "8.3.3-12",87    "@polkadot/util-crypto": "9.1.2-11",88    "bignumber.js": "^9.0.2",89    "chai-as-promised": "^7.1.1",90    "find-process": "^1.4.7",91    "solc": "^0.8.13",92    "web3": "^1.7.3"93  },94  "standard": {95    "globals": [96      "it",97      "assert",98      "beforeEach",99      "afterEach",100      "describe",101      "contract",102      "artifacts"103    ]104  },105  "resolutions": {106    "simple-get": "^4.0.1"107  }108}
modifiedtests/src/nesting/graphs.test.tsdiffbeforeafterboth
--- a/tests/src/nesting/graphs.test.ts
+++ b/tests/src/nesting/graphs.test.ts
@@ -32,10 +32,10 @@
   return collectionId;
 }
 
-describe.skip('Graphs', () => {
+describe('Graphs', () => {
   it('Ouroboros can\'t be created in a complex graph', async () => {
     await usingApi(async api => {
-      const alice = privateKey('//alice');
+      const alice = privateKey('//Alice');
       const collection = await buildComplexObjectGraph(api, alice);
 
       // to self
@@ -55,197 +55,3 @@
     });
   });
 });
-
-import type { EventRecord } from '@polkadot/types/interfaces';
-import type { GenericEventData } from '@polkadot/types';
-import type { Option, Bytes } from '@polkadot/types-codec';
-import type {
-    RmrkTypesCollectionInfo as Collection,
-    RmrkTypesNftInfo as Nft,
-    RmrkTypesResourceInfo as Resource,
-    RmrkTypesBaseInfo as Base,
-    RmrkTypesPartType as PartType,
-    RmrkTypesNftChild as NftChild,
-    RmrkTypesTheme as Theme,
-    RmrkTypesPropertyInfo as Property,
-} from '@polkadot/types/lookup';
-
-interface TxResult<T> {
-  success: boolean;
-  successData: T | null;
-}
-
-export function extractTxResult<T>(
-  events: EventRecord[],
-  expectSection: string,
-  expectMethod: string,
-  extractAction: (data: GenericEventData) => T
-): TxResult<T> {
-  let success = false;
-  let successData = null;
-  events.forEach(({event: {data, method, section}}) => {
-    //console.log(expectSection + " "+ " " + section + " " + expectMethod + " " + method)
-    if (method == 'ExtrinsicSuccess') {
-      success = true;
-    } else if ((expectSection == section) && (expectMethod == method)) {
-      successData = extractAction(data);
-    }
-  });
-  const result: TxResult<T> = {
-      success,
-      successData,
-  };
-  return result;
-}
-
-export function extractRmrkCoreTxResult<T>(
-  events: EventRecord[],
-  expectMethod: string,
-  extractAction: (data: GenericEventData) => T
-): TxResult<T> {
-  return extractTxResult(events, 'rmrkCore', expectMethod, extractAction);
-}
-
-export async function expectTxFailure(expectedError: RegExp, promise: Promise<any>) {
-  await expect(promise).to.be.rejectedWith(expectedError);
-}
-
-export async function getCollectionsCount(api: ApiPromise): Promise<number> {
-  return (await api.rpc.rmrk.lastCollectionIdx()).toNumber();
-}
-
-export async function getCollection(api: ApiPromise, id: number): Promise<Option<Collection>> {
-  return api.rpc.rmrk.collectionById(id);
-}
-
-export async function createCollection(
-  api: ApiPromise,
-  issuerUri: string,
-  metadata: string,
-  max: number | null,
-  symbol: string
-): Promise<number> {
-  let collectionId = 0;
-
-  const oldCollectionCount = await getCollectionsCount(api);
-  const maxOptional = max ? max.toString() : null;
-  console.log(maxOptional)
-  console.log('right above me')
-
-  const issuer = privateKey(issuerUri);
-  const tx = api.tx.rmrkCore.createCollection(metadata, maxOptional, symbol);
-  const events = await executeTransaction(api, issuer, tx);
-
-  const collectionResult = extractRmrkCoreTxResult(
-    events, 'CollectionCreated', (data) => {
-      return parseInt(data[1].toString(), 10)
-    }
-  );
-  expect(collectionResult.success, 'Error: unable to create a collection').to.be.true;
-  const newCollectionCount = await getCollectionsCount(api);
-  expect(newCollectionCount).to.be.equal(oldCollectionCount + 1, 'Error: NFT collection count should increase');
-
-  collectionId = collectionResult.successData ?? 0;
-  
-  console.log(collectionId);
-
-  const collectionOption = await getCollection(api, collectionId);
-
-  expect(collectionOption.isSome, 'Error: unable to fetch created NFT collection').to.be.true;
-
-  const collection = collectionOption.unwrap();
-
-  expect(collection.metadata.toUtf8()).to.be.equal(metadata, "Error: Invalid NFT collection metadata");
-  console.log(collection.max, max)
-  expect(collection.max.isSome).to.be.equal(max !== null, "Error: Invalid NFT collection max");
-
-  if (collection.max.isSome) {
-      expect(collection.max.unwrap().toNumber()).to.be.equal(max, "Error: Invalid NFT collection max");
-  }
-  expect(collection.symbol.toUtf8()).to.be.equal(symbol, "Error: Invalid NFT collection's symbol");
-  expect(collection.nftsCount.toNumber()).to.be.equal(0, "Error: NFT collection shoudn't have any tokens");
-  expect(collection.issuer.toString()).to.be.equal(issuer.address, "Error: Invalid NFT collection issuer");
-
-  return collectionId;
-}
-
-export async function deleteCollection(
-  api: ApiPromise,
-  issuerUri: string,
-  collectionId: string
-): Promise<number> {
-  const issuer = privateKey(issuerUri);
-  const tx = api.tx.rmrkCore.destroyCollection(collectionId);
-  const events = await executeTransaction(api, issuer, tx);
-
-  const collectionTxResult = extractRmrkCoreTxResult(
-      events,
-      "CollectionDestroy",
-      (data) => {
-      return parseInt(data[1].toString(), 10);
-      }
-  );
-  expect(collectionTxResult.success, 'Error: Unable to delete NFT collection').to.be.true;
-
-  const collection = await getCollection(
-      api,
-      parseInt(collectionId, 10)
-  );
-  expect(collection.isEmpty, 'Error: NFT collection should be deleted').to.be.true;
-
-  return 0;
-}
-
-describe('Something', () => {
-  const alice = '//Alice';
-  const bob = "//Bob";
-
-  it('create NFT collection', async () => {
-    await usingApi(async api => {
-      await createCollection(api, alice, 'test-metadata', 42, 'test-symbol');
-      //console.log((await api.rpc.rmrk.base(3)).toHuman());
-    });
-  });
-
-  it('create NFT collection without token limit', async () => {
-    await usingApi(async api => {
-      await createCollection(api, alice, 'no-limit-metadata', null, 'no-limit-symbol');
-    });
-  });
-
-  it("Delete NFT collection", async () => {
-    await usingApi(async api => {
-      await createCollection(
-        api,
-        alice,
-        "test-metadata",
-        null,
-        "test-symbol"
-      ).then(async (collectionId) => {
-        await deleteCollection(api, alice, collectionId.toString());
-      });
-    });
-  });
-
-  it("[Negative] delete non-existing NFT collection", async () => {
-    await usingApi(async api => {
-      const tx = deleteCollection(api, alice, "99999");
-      await expectTxFailure(/rmrkCore.CollectionUnknown/, tx);
-    });
-  });
-
-  it("[Negative] delete not an owner NFT collection", async () => {
-    await usingApi(async api => {
-      await createCollection(
-        api,
-        alice,
-        "test-metadata",
-        null,
-        "test-symbol"
-      ).then(async (collectionId) => {
-        const tx = deleteCollection(api, bob, collectionId.toString());
-        await expectTxFailure(/uniques.NoPermission/, tx);
-      });
-    });
-  });
-});
\ No newline at end of file