Add wholeNumberSchema test

This commit is contained in:
Fabio Berger 2018-10-21 20:31:35 +02:00
parent 39c7f3dc88
commit dbf75a43c3

View File

@ -36,6 +36,7 @@ const {
relayerApiOrdersChannelUpdateSchema, relayerApiOrdersChannelUpdateSchema,
relayerApiOrdersResponseSchema, relayerApiOrdersResponseSchema,
relayerApiOrderSchema, relayerApiOrderSchema,
wholeNumberSchema,
} = schemas; } = schemas;
describe('Schema', () => { describe('Schema', () => {
@ -73,6 +74,17 @@ describe('Schema', () => {
validateAgainstSchema(testCases, numberSchema, shouldFail); 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', () => { describe('#addressSchema', () => {
it('should validate valid addresses', () => { it('should validate valid addresses', () => {
const testCases = ['0x8b0292b11a196601ed2ce54b665cafeca0347d42', NULL_ADDRESS]; const testCases = ['0x8b0292b11a196601ed2ce54b665cafeca0347d42', NULL_ADDRESS];