git.delta.rocks / unique-network / refs/commits / 9d232ae806cb

difftreelog

test evm token properties

Yaroslav Bolyukin2022-05-17parent: #e6b5895.patch.diff
in: master

3 files changed

modifiedtests/src/eth/collectionProperties.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionProperties.test.ts
+++ b/tests/src/eth/collectionProperties.test.ts
@@ -49,7 +49,6 @@
     const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});
 
     const value = await contract.methods.collectionProperty('testKey').call();
-
     expect(value).to.equal(web3.utils.toHex('testValue'));
   });
 });
addedtests/src/eth/tokenProperties.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/eth/util/helpers.ts
+++ b/tests/src/eth/util/helpers.ts
@@ -322,3 +322,15 @@
 
   return before - after;
 }
+
+type ElementOf<A> = A extends readonly (infer T)[] ? T : never;
+// I want a fancier api, not a memory efficiency
+export function* cartesian<T extends Array<Array<any>>, R extends Array<any>>(internalRest: [...R], ...args: [...T]): Generator<[...R, ...{[K in keyof T]: ElementOf<T[K]>}]> {
+  if(args.length === 0) {
+    yield internalRest as any;
+    return;
+  }
+  for(const value of args[0]) {
+    yield* cartesian([...internalRest, value], ...args.slice(1)) as any;
+  }
+}
\ No newline at end of file