2017-07-02 05:49:06 +00:00
|
|
|
import {
|
|
|
|
isValidBTCAddress,
|
|
|
|
isValidETHAddress
|
|
|
|
} from '../../common/libs/validators';
|
2017-07-04 00:16:20 +00:00
|
|
|
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', () => {
|
2017-07-04 00:16:20 +00:00
|
|
|
expect(isValidBTCAddress(donationAddressMap.BTC)).toBeTruthy();
|
2017-07-02 05:49:06 +00:00
|
|
|
});
|
|
|
|
it('should validate incorrect BTC address as false', () => {
|
|
|
|
expect(
|
2017-07-04 00:16:20 +00:00
|
|
|
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', () => {
|
2017-07-04 00:16:20 +00:00
|
|
|
expect(isValidETHAddress(donationAddressMap.ETH)).toBeTruthy();
|
2017-07-02 05:49:06 +00:00
|
|
|
});
|
|
|
|
it('should validate incorrect ETH address as false', () => {
|
|
|
|
expect(
|
2017-07-04 00:16:20 +00:00
|
|
|
isValidETHAddress('nonsense' + donationAddressMap.ETH + 'nonsense')
|
2017-07-02 05:49:06 +00:00
|
|
|
).toBeFalsy();
|
|
|
|
});
|
2017-06-26 23:38:45 +00:00
|
|
|
});
|