Add tests for Validator

This commit is contained in:
Daniel Ternyak 2017-06-24 15:46:30 -05:00
parent dab75a48b0
commit 142ed3adc5
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
import Validator from '../../common/libs/validator';
import { DONATION_ADDRESSES_MAP } from '../../common/config/data';
describe('Validator', () => {
it('should validate correct BTC address as true', () => {
const validator = new Validator();
expect(
validator.isValidBTCAddress(DONATION_ADDRESSES_MAP.BTC)
).toBeTruthy();
});
it('should validate incorrect BTC address as false', () => {
const validator = new Validator();
expect(
validator.isValidBTCAddress(
'nonsense' + DONATION_ADDRESSES_MAP.BTC + 'nonsense'
)
).toBeFalsy();
});
it('should validate correct ETH address as true', () => {
const validator = new Validator();
expect(
validator.isValidETHAddress(DONATION_ADDRESSES_MAP.ETH)
).toBeTruthy();
});
it('should validate incorrect ETH address as false', () => {
const validator = new Validator();
expect(
validator.isValidETHAddress(
'nonsense' + DONATION_ADDRESSES_MAP.ETH + 'nonsense'
)
).toBeFalsy();
});
});