aboutsummaryrefslogtreecommitdiffstats
path: root/packages/json-schemas/test/schema_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/json-schemas/test/schema_test.ts')
-rw-r--r--packages/json-schemas/test/schema_test.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/json-schemas/test/schema_test.ts b/packages/json-schemas/test/schema_test.ts
index 4e0f66ef5..bfa2c5668 100644
--- a/packages/json-schemas/test/schema_test.ts
+++ b/packages/json-schemas/test/schema_test.ts
@@ -1,4 +1,4 @@
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as dirtyChai from 'dirty-chai';
import forEach = require('lodash.foreach');
@@ -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];