MyCrypto/spec/libs/validators.spec.js

26 lines
804 B
JavaScript
Raw Normal View History

2017-07-02 05:49:06 +00:00
import {
isValidBTCAddress,
isValidETHAddress
} from '../../common/libs/validators';
import { donationAddressMap } from '../../common/config/data';
2017-06-26 23:38:45 +00:00
describe('Validator', () => {
2017-07-02 05:49:06 +00:00
it('should validate correct BTC address as true', () => {
expect(isValidBTCAddress(donationAddressMap.BTC)).toBeTruthy();
2017-07-02 05:49:06 +00:00
});
it('should validate incorrect BTC address as false', () => {
expect(
isValidBTCAddress('nonsense' + donationAddressMap.BTC + 'nonsense')
2017-07-02 05:49:06 +00:00
).toBeFalsy();
});
2017-06-26 23:38:45 +00:00
2017-07-02 05:49:06 +00:00
it('should validate correct ETH address as true', () => {
expect(isValidETHAddress(donationAddressMap.ETH)).toBeTruthy();
2017-07-02 05:49:06 +00:00
});
it('should validate incorrect ETH address as false', () => {
expect(
isValidETHAddress('nonsense' + donationAddressMap.ETH + 'nonsense')
2017-07-02 05:49:06 +00:00
).toBeFalsy();
});
2017-06-26 23:38:45 +00:00
});