aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Evans <jacob@dekz.net>2018-02-06 09:11:45 +0800
committerJacob Evans <jacob@dekz.net>2018-02-06 09:11:45 +0800
commit20590b7d35208bf3fb79ce6f06198ea995b05f91 (patch)
tree09e41610b7ddc3d858a2714046a0393cabece309
parentfce70812150340a039a4bc02861e93574c1e965f (diff)
downloaddexon-sol-tools-20590b7d35208bf3fb79ce6f06198ea995b05f91.tar
dexon-sol-tools-20590b7d35208bf3fb79ce6f06198ea995b05f91.tar.gz
dexon-sol-tools-20590b7d35208bf3fb79ce6f06198ea995b05f91.tar.bz2
dexon-sol-tools-20590b7d35208bf3fb79ce6f06198ea995b05f91.tar.lz
dexon-sol-tools-20590b7d35208bf3fb79ce6f06198ea995b05f91.tar.xz
dexon-sol-tools-20590b7d35208bf3fb79ce6f06198ea995b05f91.tar.zst
dexon-sol-tools-20590b7d35208bf3fb79ce6f06198ea995b05f91.zip
Rename called to something more readable
-rw-r--r--packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts
index cffb4cdee..738b8bc95 100644
--- a/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts
+++ b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts
@@ -38,15 +38,16 @@ describe('NonceTrackerSubprovider', () => {
'0x5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13',
];
function createFixtureSubprovider() {
- let called = false;
+ let firstGetTransactionCount = true;
const fixedBlockNumberAndTransactionCountProvider = new FixtureSubprovider({
eth_getBlockByNumber: '0x01',
eth_getTransactionCount: (data: any, next: any, end: any) => {
- if (called) {
- return end(null, '0x99');
- } else {
- called = true;
+ // For testing caching we return different results on the second call
+ if (firstGetTransactionCount) {
+ firstGetTransactionCount = false;
end(null, '0x00');
+ } else {
+ end(null, '0x99');
}
},
});