-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update estimate overrides to throw error when decimal values are bein…
…g passed as well as update tests
- Loading branch information
Showing
6 changed files
with
95 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { CONFIGS } from "./config"; | ||
import { InvalidEstimateValueError } from '@taquito/taquito'; | ||
|
||
CONFIGS().forEach(({ lib, rpc, setup, createAddress }) => { | ||
const Tezos = lib; | ||
|
||
describe(`Test contract API operations with overridden estimate values ${rpc}`, () => { | ||
let pkh: string; | ||
|
||
beforeAll(async (done) => { | ||
await setup(); | ||
|
||
try { | ||
const account = await createAddress(); | ||
pkh = await account.signer.publicKeyHash(); | ||
} catch(e) { | ||
console.log(JSON.stringify(e)); | ||
} | ||
|
||
done(); | ||
}); | ||
|
||
it('should throw an error when overriding origination estimate values with decimals', async (done) => { | ||
expect(async () => { | ||
const op = await Tezos.contract.originate({ | ||
balance: "1", | ||
code: `parameter string; | ||
storage string; | ||
code {CAR; | ||
PUSH string "Hello "; | ||
CONCAT; | ||
NIL operation; PAIR}; | ||
`, | ||
init: `"test"`, | ||
storageLimit: 100.22 | ||
}); | ||
await op.confirmation(); | ||
}).rejects.toThrowError(InvalidEstimateValueError); | ||
|
||
done(); | ||
}); | ||
|
||
it('should throw an error when overriding transfer/transaction estimate values with decimal', async (done) => { | ||
expect(async () => { | ||
const op = await Tezos.contract.transfer({ | ||
to: pkh, | ||
amount: 1, | ||
fee: 10.5 | ||
}); | ||
await op.confirmation(); | ||
}).rejects.toThrowError(InvalidEstimateValueError); | ||
|
||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters