difftreelog
test evm token properties
in: master
3 files changed
tests/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'));
});
});
tests/src/eth/tokenProperties.test.tsdiffbeforeafterbothno changes
tests/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