mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-23 00:08:37 +00:00
Add tests for Validator
This commit is contained in:
parent
dab75a48b0
commit
142ed3adc5
34
spec/libs/validator.spec.js
Normal file
34
spec/libs/validator.spec.js
Normal 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();
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user