git.delta.rocks / unique-network / refs/commits / 3ce311c312ce

difftreelog

test query properties rpc

Daniel Shiposha2022-09-29parent: #e899eee.patch.diff
in: master

3 files changed

modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -38,7 +38,7 @@
     "testNesting": "mocha --timeout 9999999 -r ts-node/register ./**/nest.test.ts",
     "testUnnesting": "mocha --timeout 9999999 -r ts-node/register ./**/unnest.test.ts",
     "testStructure": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/**.test.ts",
-    "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts",
+    "testProperties": "mocha --timeout 9999999 -r ts-node/register ./**/properties.test.ts ./**/getPropertiesRpc.test.ts",
     "testMigration": "mocha --timeout 9999999 -r ts-node/register ./**/nesting/migration-check.test.ts",
     "testRmrk": "mocha --timeout 9999999 -r ts-node/register ./**/rmrk/**.test.ts",
     "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts",
addedtests/src/getPropertiesRpc.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/util/playgrounds/unique.tsdiffbeforeafterboth
--- a/tests/src/util/playgrounds/unique.ts
+++ b/tests/src/util/playgrounds/unique.ts
@@ -926,8 +926,8 @@
    * @example getProperties(1219, ['location', 'date', 'time', 'isParadise']);
    * @returns array of key-value pairs
    */
-  async getProperties(collectionId: number, propertyKeys: string[] | null = null): Promise<IProperty[]> {
-    return (await this.helper.callRpc('api.rpc.unique.collectionProperties', [collectionId, ...(propertyKeys === null ? [] : [propertyKeys])])).toHuman();
+  async getProperties(collectionId: number, propertyKeys?: string[] | null): Promise<IProperty[]> {
+    return (await this.helper.callRpc('api.rpc.unique.collectionProperties', [collectionId, propertyKeys])).toHuman();
   }
 
   /**
@@ -1208,8 +1208,8 @@
    * @example getTokenProperties(1219, ['location', 'date', 'time', 'isParadise']);
    * @returns array of key-value pairs
    */
-  async getTokenProperties(collectionId: number, tokenId: number, propertyKeys: string[] | null = null): Promise<IProperty[]> {
-    return (await this.helper.callRpc('api.rpc.unique.tokenProperties', [collectionId, tokenId, ...(propertyKeys === null ? [] : [propertyKeys])])).toHuman();
+  async getTokenProperties(collectionId: number, tokenId: number, propertyKeys?: string[] | null): Promise<IProperty[]> {
+    return (await this.helper.callRpc('api.rpc.unique.tokenProperties', [collectionId, tokenId, propertyKeys])).toHuman();
   }
 
   /**
@@ -2265,7 +2265,7 @@
     return await this.helper.collection.getEffectiveLimits(this.collectionId);
   }
 
-  async getProperties(propertyKeys: string[] | null = null) {
+  async getProperties(propertyKeys?: string[] | null) {
     return await this.helper.collection.getProperties(this.collectionId, propertyKeys);
   }
 
@@ -2364,7 +2364,7 @@
     return await this.helper.nft.getPropertyPermissions(this.collectionId, propertyKeys);
   }
 
-  async getTokenProperties(tokenId: number, propertyKeys: string[] | null = null) {
+  async getTokenProperties(tokenId: number, propertyKeys?: string[] | null) {
     return await this.helper.nft.getTokenProperties(this.collectionId, tokenId, propertyKeys);
   }
 
@@ -2455,7 +2455,7 @@
     return await this.helper.rft.getPropertyPermissions(this.collectionId, propertyKeys);
   }
 
-  async getTokenProperties(tokenId: number, propertyKeys: string[] | null = null) {
+  async getTokenProperties(tokenId: number, propertyKeys?: string[] | null) {
     return await this.helper.rft.getTokenProperties(this.collectionId, tokenId, propertyKeys);
   }
 
@@ -2567,7 +2567,7 @@
     return await this.collection.getTokenNextSponsored(this.tokenId, addressObj);
   }
 
-  async getProperties(propertyKeys: string[] | null = null) {
+  async getProperties(propertyKeys?: string[] | null) {
     return await this.collection.getTokenProperties(this.tokenId, propertyKeys);
   }