aboutsummaryrefslogtreecommitdiffstats
path: root/packages/json-schemas/test/schema_test.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-10-25 03:56:11 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-10-25 03:56:11 +0800
commit6da6540c038640abf75f703a294cb758c6defc47 (patch)
treebf320d263a86da9b0f75358305649f4d00b94265 /packages/json-schemas/test/schema_test.ts
parentf89b314a94f867fa905a1ce18eba9336ee4d1634 (diff)
parent06ba26a6d30565e7c6c4032528089d30ecc39fdd (diff)
downloaddexon-sol-tools-6da6540c038640abf75f703a294cb758c6defc47.tar
dexon-sol-tools-6da6540c038640abf75f703a294cb758c6defc47.tar.gz
dexon-sol-tools-6da6540c038640abf75f703a294cb758c6defc47.tar.bz2
dexon-sol-tools-6da6540c038640abf75f703a294cb758c6defc47.tar.lz
dexon-sol-tools-6da6540c038640abf75f703a294cb758c6defc47.tar.xz
dexon-sol-tools-6da6540c038640abf75f703a294cb758c6defc47.tar.zst
dexon-sol-tools-6da6540c038640abf75f703a294cb758c6defc47.zip
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/input-fees-rounding
Diffstat (limited to 'packages/json-schemas/test/schema_test.ts')
-rw-r--r--packages/json-schemas/test/schema_test.ts12
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];