|
| 1 | +const {describe, it} = require('mocha'); |
| 2 | +const {expect} = require('chai'); |
| 3 | +const Regex = require('./index'); |
| 4 | +const email = "[email protected]"; |
| 5 | +const PersianString = "نیما حبیب خدا"; |
| 6 | +const number = "123456789"; |
| 7 | + |
| 8 | +describe('Persian-Regex', () => { |
| 9 | + describe('#isPersian()', () => { |
| 10 | + it('should be a method', () => { |
| 11 | + expect(Regex).to.respondTo('isPersian'); |
| 12 | + }); |
| 13 | + |
| 14 | + it('should return True', () => { |
| 15 | + expect(Regex.isPersian(PersianString)).to.be.true; |
| 16 | + }); |
| 17 | + |
| 18 | + it('should return False', () => { |
| 19 | + expect(Regex.isPersian(email)).to.be.false; |
| 20 | + }); |
| 21 | + }); |
| 22 | + |
| 23 | + describe('#isNumber()', () => { |
| 24 | + it('should be a method', () => { |
| 25 | + expect(Regex).to.respondTo('isNumber'); |
| 26 | + }); |
| 27 | + |
| 28 | + it('should return true', () => { |
| 29 | + const isNumber = Regex.isNumber(number); |
| 30 | + expect(isNumber).to.be.true; |
| 31 | + }); |
| 32 | + |
| 33 | + it('should return False', () => { |
| 34 | + expect(Regex.isNumber(email)).to.be.false; |
| 35 | + }); |
| 36 | + }); |
| 37 | + |
| 38 | + describe('#isEmail()', () => { |
| 39 | + it('should be a method', () => { |
| 40 | + expect(Regex).to.respondTo('isNumber'); |
| 41 | + }); |
| 42 | + |
| 43 | + it('should return true', () => { |
| 44 | + const isEmail = Regex.isEmail(email); |
| 45 | + expect(isEmail).to.be.true; |
| 46 | + }); |
| 47 | + |
| 48 | + it('should return False', () => { |
| 49 | + expect(Regex.isEmail(number)).to.be.false; |
| 50 | + }); |
| 51 | + }); |
| 52 | +}); |
0 commit comments