From 6fce9029c5dd3dbc1d071f959cf82ac4a228df00 Mon Sep 17 00:00:00 2001 From: crptm Date: Tue, 27 Jun 2017 03:38:45 +0400 Subject: [PATCH] fix spec --- spec/libs/validator.spec.js | 34 ---------------------------------- spec/libs/validators.spec.js | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 34 deletions(-) delete mode 100644 spec/libs/validator.spec.js create mode 100644 spec/libs/validators.spec.js diff --git a/spec/libs/validator.spec.js b/spec/libs/validator.spec.js deleted file mode 100644 index a29b0bc8..00000000 --- a/spec/libs/validator.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -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(); - }); -}); diff --git a/spec/libs/validators.spec.js b/spec/libs/validators.spec.js new file mode 100644 index 00000000..024e2ab9 --- /dev/null +++ b/spec/libs/validators.spec.js @@ -0,0 +1,18 @@ +import { isValidBTCAddress, isValidETHAddress } from '../../common/libs/validators'; +import { DONATION_ADDRESSES_MAP } from '../../common/config/data'; + +describe('Validator', () => { + it('should validate correct BTC address as true', () => { + expect(isValidBTCAddress(DONATION_ADDRESSES_MAP.BTC)).toBeTruthy(); + }); + it('should validate incorrect BTC address as false', () => { + expect(isValidBTCAddress('nonsense' + DONATION_ADDRESSES_MAP.BTC + 'nonsense')).toBeFalsy(); + }); + + it('should validate correct ETH address as true', () => { + expect(isValidETHAddress(DONATION_ADDRESSES_MAP.ETH)).toBeTruthy(); + }); + it('should validate incorrect ETH address as false', () => { + expect(isValidETHAddress('nonsense' + DONATION_ADDRESSES_MAP.ETH + 'nonsense')).toBeFalsy(); + }); +});