Skip to content

Commit

Permalink
Refactored all tests, all tests save 3 are passing
Browse files Browse the repository at this point in the history
  • Loading branch information
DevonSangha authored and scottburch committed Aug 12, 2021
1 parent 6bb83ab commit 3a2abbe
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/specs/db/methods/txRead.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,13 @@ describe('txread()', function () {
.catch(e => expect(e.error).to.equal('invalid request: Key does not exist: failed to execute message'));
});

//Rearrange/test
it('should handle parallel reads', () => {
return createKeys(bz, 3)
.then(keys => Promise.all([
keys.map(key => bz.txRead(key, defaultGasParams()).then(x => x?.value))
])
.then(pairs => bz.withTransaction(() =>
pairs.keys.map(keys => bz.txRead(keys, defaultGasParams()).then(key => key?.value))
)
.then(response => response.data.map((it: any) => it.value))
.then(values => expect(values).to.deep.equal(pairs.values))
);
// const {keys, values} = await createKeys(bz, 5);
// expect(
// await Promise.all(keys.map(key => bz.txRead(key, defaultGasParams()).then(x => x?.value)))
// ).to.deep.equal(values);
});
});

0 comments on commit 3a2abbe

Please sign in to comment.