diff options
author | Fabio Berger <me@fabioberger.com> | 2018-10-22 02:31:35 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-10-22 02:31:35 +0800 |
commit | dbf75a43c37af31858dfca4026ab12f0491c520f (patch) | |
tree | 46772386ec5afdba3ca43baf47db28609492d04b /packages | |
parent | 39c7f3dc88d5e43399e055a2535ce2cddb560f4c (diff) | |
download | dexon-sol-tools-dbf75a43c37af31858dfca4026ab12f0491c520f.tar.gz dexon-sol-tools-dbf75a43c37af31858dfca4026ab12f0491c520f.tar.zst dexon-sol-tools-dbf75a43c37af31858dfca4026ab12f0491c520f.zip |
Add wholeNumberSchema test
Diffstat (limited to 'packages')
-rw-r--r-- | packages/json-schemas/test/schema_test.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts index 795261ef2..bfa2c5668 100644 --- a/packages/json-schemas/test/schema_test.ts +++ b/packages/json-schemas/test/schema_test.ts @@ -36,6 +36,7 @@ const { relayerApiOrdersChannelUpdateSchema, relayerApiOrdersResponseSchema, relayerApiOrderSchema, + wholeNumberSchema, } = schemas; describe('Schema', () => { @@ -73,6 +74,17 @@ describe('Schema', () => { validateAgainstSchema(testCases, numberSchema, shouldFail); }); }); + describe('#wholeNumberSchema', () => { + it('should validate valid numbers', () => { + const testCases = ['5', '42', '0']; + validateAgainstSchema(testCases, wholeNumberSchema); + }); + it('should fail for invalid numbers', () => { + const testCases = ['1.3', '0.2', '00.00', '.3', '1.', 'abacaba', 'и', '1..0']; + const shouldFail = true; + validateAgainstSchema(testCases, wholeNumberSchema, shouldFail); + }); + }); describe('#addressSchema', () => { it('should validate valid addresses', () => { const testCases = ['0x8b0292b11a196601ed2ce54b665cafeca0347d42', NULL_ADDRESS]; |