test.js 733 B

1234567891011121314151617181920212223242526272829
  1. var slug = require('../');
  2. var should = require('should');
  3. var MATCHES = {
  4. 'hello': 'hello',
  5. 'hello world': 'hello-world',
  6. '!weird + id/for headings': 'weird--idfor-heading',
  7. '您好': '您好',
  8. 'I ♥ you': 'i--you',
  9. 'a > b': 'a--b',
  10. 'Schöner Titel läßt grüßen!? Bel été !': 'schöner-titel-läßt-grüßen-bel-été-'
  11. }
  12. describe('slug', function () {
  13. for (var value in MATCHES) {
  14. var expected = MATCHES[value];
  15. it('should handle '+ JSON.stringify(value), function() {
  16. slug(value).should.equal(expected);
  17. });
  18. it('should handle '+ JSON.stringify(expected), function() {
  19. slug(expected).should.equal(expected);
  20. });
  21. }
  22. });