| Total Complexity | 7 |
| Complexity/F | 1 |
| Lines of Code | 56 |
| Function Count | 7 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | import chai from 'chai'; |
||
| 2 | import {slugify} from '../src/strman'; |
||
| 3 | |||
| 4 | describe('Slugfiy function', () => { |
||
| 5 | it('should be foo-bar', () => { |
||
| 6 | let fixtures = [ |
||
| 7 | 'foo bar', |
||
| 8 | 'foo bar.', |
||
| 9 | 'foo bar ', |
||
| 10 | ' foo bar', |
||
| 11 | ' foo bar ', |
||
| 12 | 'foo------bar', |
||
| 13 | 'fóõ bár', |
||
| 14 | 'foo ! bar', |
||
| 15 | 'foo ~~ bar', |
||
| 16 | 'foo bar', |
||
| 17 | 'FOO bar' |
||
| 18 | ]; |
||
| 19 | |||
| 20 | fixtures.forEach(el => { |
||
| 21 | chai.expect(slugify(el)).to.equal('foo-bar'); |
||
| 22 | }); |
||
| 23 | }); |
||
| 24 | it('should be foo-and-bar', () => { |
||
| 25 | let fixtures = [ |
||
| 26 | 'foo&bar', |
||
| 27 | 'foo&bar.', |
||
| 28 | 'foo&bar ', |
||
| 29 | ' foo&bar', |
||
| 30 | ' foo&bar ', |
||
| 31 | 'foo&bar', |
||
| 32 | 'fóõ-and---bár', |
||
| 33 | 'foo & bar', |
||
| 34 | 'FOO & bar' |
||
| 35 | ]; |
||
| 36 | |||
| 37 | fixtures.forEach(el => { |
||
| 38 | chai.expect(slugify(el)).to.equal('foo-and-bar'); |
||
| 39 | }); |
||
| 40 | }); |
||
| 41 | |||
| 42 | it('should be throw', () => { |
||
| 43 | let fixtures = [ |
||
| 44 | 1, |
||
| 45 | [], |
||
| 46 | {}, |
||
| 47 | 1.2, |
||
| 48 | false, |
||
| 49 | true |
||
| 50 | ]; |
||
| 51 | |||
| 52 | fixtures.forEach(el => { |
||
| 53 | chai.assert.throws(slugify.bind(this, el), Error); |
||
| 54 | }); |
||
| 55 | }); |
||
| 56 | }); |
||
| 57 |