first-commit
Some checks failed
CI Pipeline / build (push) Failing after 3m23s

This commit is contained in:
2025-08-27 14:05:33 +08:00
commit 9e1b8bdc9d
5159 changed files with 1081326 additions and 0 deletions

2
node_modules/speakingurl/test/mocha.opts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
--require should
--reporter spec

111
node_modules/speakingurl/test/test-accent.js generated vendored Normal file
View File

@@ -0,0 +1,111 @@
/* global describe,it, before */
describe('getSlug translate sentence with accent words', function () {
'use strict';
describe('default options', function () {
var getSlug = require('../lib/speakingurl').createSlug({
});
it('single word', function (done) {
getSlug('Ánhanguera')
.should.eql('anhanguera');
done();
});
it('middle of sentence', function (done) {
getSlug('foo Ánhanguera bar')
.should.eql('foo-anhanguera-bar');
done();
});
it('beginning of sentence', function (done) {
getSlug('Ánhanguera foo bar')
.should.eql('anhanguera-foo-bar');
done();
});
it('end of sentence', function (done) {
getSlug('Ánhanguera fooá')
.should.eql('anhanguera-fooa');
done();
});
});
describe('titlecase options', function () {
var getSlug = require('../lib/speakingurl').createSlug({
titleCase: [
'a', 'an', 'and', 'as', 'at', 'but',
'by', 'en', 'for', 'if', 'in', 'nor',
'of', 'on', 'or', 'per', 'the', 'to', 'vs'
]
});
it('single word', function (done) {
getSlug('Ánhanguera')
.should.eql('Anhanguera');
done();
});
it('middle of sentence', function (done) {
getSlug('foo Ánhanguera bar')
.should.eql('Foo-Anhanguera-Bar');
done();
});
it('middle of sentence, with exception', function (done) {
getSlug('foo Ánhanguera And bar')
.should.eql('Foo-Anhanguera-and-Bar');
done();
});
it('beginning of sentence', function (done) {
getSlug('Ánhanguera foo Ánhanguera')
.should.eql('Anhanguera-Foo-Anhanguera');
done();
});
it('beginning of sentence, with exception', function (done) {
getSlug('Ánhanguera and Ánhanguera')
.should.eql('Anhanguera-and-Anhanguera');
done();
});
it('end of sentence', function (done) {
getSlug('Ánhanguera foo bará')
.should.eql('Anhanguera-Foo-Bara');
done();
});
it('end of sentence, with exception', function (done) {
getSlug('Ánhanguera foo and bará')
.should.eql('Anhanguera-Foo-and-Bara');
done();
});
});
});

18
node_modules/speakingurl/test/test-arabic.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug translate arabic letters', function () {
'use strict';
it('should be ', function (done) {
getSlug('بشس تاقفغقف - ت ب ي ق', {
lang: 'ar'
})
.should.eql('bshs-taqfghqf-t-b-y-q');
done();
});
});

205
node_modules/speakingurl/test/test-burmese.js generated vendored Normal file
View File

@@ -0,0 +1,205 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug translate burmese letters', function () {
'use strict';
it('one consonant', function (done) {
getSlug('မ', {
lang: 'my'
})
.should.eql('m');
done();
});
it('one independent vowel', function (done) {
getSlug('ဪ', {
lang: 'my'
})
.should.eql('aw');
done();
});
it('one consonant with one vowel', function (done) {
getSlug('ကာ', {
lang: 'my'
})
.should.eql('ka');
done();
});
it('one consonant and multiple vowels', function (done) {
getSlug('ကော', {
lang: 'my'
})
.should.eql('kaw');
getSlug('ကော်', {
lang: 'my'
})
.should.eql('kaw');
getSlug('ကွဲ', {
lang: 'my'
})
.should.eql('kwe');
getSlug('ပေါ်', {
lang: 'my'
})
.should.eql('paw');
getSlug('ပို', {
lang: 'my'
})
.should.eql('po');
getSlug('ကူ', {
lang: 'my'
})
.should.eql('ku');
done();
});
it('one consonant and multiple medials', function (done) {
getSlug('မျှ', {
lang: 'my'
})
.should.eql('myah');
getSlug('ကြွ', {
lang: 'my'
})
.should.eql('kyw');
getSlug('လွှ', {
lang: 'my'
})
.should.eql('lwh');
getSlug('မြွှ', {
lang: 'my'
})
.should.eql('mywh');
getSlug('ကုံ', {
lang: 'my'
})
.should.eql('kon');
getSlug('ဘွိုင်း', {
lang: 'my'
})
.should.eql('bawaing');
getSlug('လျှင်', {
lang: 'my'
})
.should.eql('lyahin');
done();
});
it('one pali word', function (done) {
getSlug('စ္စ', {
lang: 'my'
})
.should.eql('ss');
done();
});
it('one single consonant and one consonant with asat', function (done) {
getSlug('ကက်', {
lang: 'my'
})
.should.eql('ket');
getSlug('ပိုက်', {
lang: 'my'
})
.should.eql('paik');
getSlug('ကောက်', {
lang: 'my'
})
.should.eql('kauk');
done();
});
it('pali asat and tone marks', function (done) {
getSlug('ကျွန်ုပ်', {
lang: 'my'
})
.should.eql('kyawnub');
getSlug('ပစ္စည်း', {
lang: 'my'
})
.should.eql('pssi');
getSlug('တက္ကသိုလ်', {
lang: 'my'
})
.should.eql('tkkthol');
getSlug('သဏ္ဍာန်', {
lang: 'my'
})
.should.eql('thnadan');
getSlug('လိမ္မော်', {
lang: 'my'
})
.should.eql('limmaw');
getSlug('စက္ကူ', {
lang: 'my'
})
.should.eql('skku');
getSlug('ဘဏ္ဍာ', {
lang: 'my'
})
.should.eql('banada');
getSlug('မင်္ဂလာ', {
lang: 'my'
})
.should.eql('mingla');
done();
});
it('simple sentence with spaces and tone marks', function (done) {
getSlug('မြန်မာပြည် ကို တို့ချစ်သည်၊ တို့တိုင်းတို့ပြည်', {
lang: 'my'
})
.should.eql('myanmapyi-ko-tokhyaitthi-totaingtopyi');
getSlug('သတ္တဝါတွေ ကျန်းမာပါစေ။', {
lang: 'my'
})
.should.eql('thttwatwe-kyaanmapase');
getSlug('မြန်မာ သာဓက', {
lang: 'my'
})
.should.eql('myanma-thadak');
done();
});
it('complex sentences with combinations of consonants, vowels and diatrics', function (done) {
getSlug('ဘင်္ဂလား ပင်လယ်အော် တွင် ယနေ့ နေသာသည်။', {
lang: 'my'
})
.should.eql('baingla-pinleaaw-twin-yne-nethathi');
getSlug('ဗုဒ္ဓဘာသာ မြန်မာလူမျိုး', {
lang: 'my'
})
.should.eql('buddabaatha-myanmalumyao');
done();
});
});

337
node_modules/speakingurl/test/test-create.js generated vendored Normal file
View File

@@ -0,0 +1,337 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug create', function () {
'use strict';
it('with symbols', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true
});
getSlug('Foo (♥) ; Baz=Bar')
.should.eql('foo-(love)-;-baz=bar');
done();
});
it('without options', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug();
getSlug('Foo Bar Baz')
.should.eql('foo-bar-baz');
done();
});
it('with empty options', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({});
getSlug('Foo Bar Baz')
.should.eql('foo-bar-baz');
done();
});
it('with maintainCase', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
maintainCase: true
});
getSlug('Foo Bar Baz')
.should.eql('Foo-Bar-Baz');
done();
});
it('with uric', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
uric: true
});
getSlug(' :80:/Foo/Bar/Baz:Foo')
.should.eql(':80:/foo/bar/baz:foo');
done();
});
it('with uricNoSlash', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
uricNoSlash: true
});
getSlug('Foo/ Bar= Baz')
.should.eql('foo-bar=-baz');
done();
});
it('with mark', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
mark: true
});
getSlug('Foo* Bar Baz')
.should.eql('foo*-bar-baz');
done();
});
it('with truncate', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
truncate: 15
});
getSlug('Foo* Foobar FooBarBaz')
.should.eql('foo-foobar');
done();
});
it('with separator', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
separator: '_'
});
getSlug('Foo* Foobar FooBarBaz')
.should.eql('foo_foobar_foobarbaz');
done();
});
it('with mark and maintainCase', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
mark: true,
maintainCase: true
});
getSlug('Foo* Bar Baz')
.should.eql('Foo*-Bar-Baz');
done();
});
it('with custom chars replacement', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
custom: {
'*': 'o'
}
});
getSlug('xyl*ph*n')
.should.eql('xylophon');
done();
});
it('with custom chars leet replacement', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
custom: {
'a': '4',
'b': '8',
'e': '3',
'g': '6',
'l': '1',
'o': '0',
's': '5',
't': '7'
},
lang: false
});
getSlug('apbpepgplpopspt')
.should.eql('4p8p3p6p1p0p5p7');
getSlug('papbpepgplpopsptp')
.should.eql('p4p8p3p6p1p0p5p7p');
getSlug('qabqegqloqst')
.should.eql('q48q36q10q57');
getSlug('abeglost')
.should.eql('48361057');
done();
});
it('with custom chars replacement with not allowed target char', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
custom: {
'o': '*'
}
});
getSlug('xylophon')
.should.eql('xyl-ph-n');
done();
});
it('with custom chars replacement with allowed target char, option mark', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
custom: {
'o': '*'
},
mark: true
});
getSlug('xylophon')
.should.eql('xyl*ph*n');
done();
});
it('with custom chars replacement with option mark', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
custom: {
'*': 'o'
},
mark: true
});
getSlug('xyl*ph*n')
.should.eql('xylophon');
done();
});
it('with custom char to string replacement', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
custom: {
'*': 'STAR',
'q': 'qqq',
'and': '',
'or': ''
}
});
getSlug('xyl*ph*n')
.should.eql('xylstarphstarn');
getSlug('quack')
.should.eql('qqquack');
getSlug('Foo and Bar or Baz')
.should.eql('foo-bar-baz');
done();
});
it('with custom string replacement', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
custom: {
'and': 'und',
'or': 'oder',
'*': ' and '
}
});
getSlug('bus and train')
.should.eql('bus-und-train');
getSlug('bus or train')
.should.eql('bus-oder-train');
getSlug('busandtrain')
.should.eql('busandtrain');
getSlug('busortrain')
.should.eql('busortrain');
getSlug('bus*train')
.should.eql('bus-and-train');
getSlug('bus and train bus and train')
.should.eql('bus-und-train-bus-und-train');
getSlug('bus or train bus or train')
.should.eql('bus-oder-train-bus-oder-train');
getSlug('busandtrain busandtrain')
.should.eql('busandtrain-busandtrain');
getSlug('busortrain busortrain')
.should.eql('busortrain-busortrain');
done();
});
it('with custom string replacement with option mark', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
custom: {
'*': 'STAR',
'q': 'qqq',
'z': ''
},
mark: true
});
getSlug('xyl*ph*n')
.should.eql('xylstarphstarn');
getSlug('qxxx')
.should.eql('qqqxxx');
getSlug('xxxqxxx')
.should.eql('xxxqqqxxx');
getSlug('qqq')
.should.eql('qqqqqqqqq');
getSlug('*q*')
.should.eql('starqqqstar');
getSlug('zoo')
.should.eql('oo');
getSlug('zooz')
.should.eql('oo');
done();
});
it('with custom string replacement with option maintainCase', function (done) {
var getSlug = require('../lib/speakingurl')
.createSlug({
custom: {
'*': 'STAR',
'q': 'qqq',
},
maintainCase: true
});
getSlug('xyl*ph*n')
.should.eql('xylSTARphSTARn');
getSlug('qXXX')
.should.eql('qqqXXX');
getSlug('qqq')
.should.eql('qqqqqqqqq');
getSlug('*q*')
.should.eql('STARqqqSTAR');
done();
});
});

98
node_modules/speakingurl/test/test-custom.js generated vendored Normal file
View File

@@ -0,0 +1,98 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug with custom replacement', function () {
'use strict';
it('should be transliterated', function (done) {
getSlug('буу', {
lang: false,
custom: {
'б': 'б',
'у': 'у'
}
})
.should.eql('буу');
getSlug('[nodejs]', {
custom: {
'[': '[',
']': ']'
}
})
.should.eql('[nodejs]');
getSlug('[Äpfel]', {
custom: {
'[': '[',
']': ']'
}
})
.should.eql('[aepfel]');
getSlug('[Äpfel]', {
lang: false,
custom: {
'[': '[',
']': ']'
}
})
.should.eql('[aepfel]');
done();
});
it('should be extended with allowed chars', function (done) {
getSlug('буу', {
custom: ['б', 'у']
})
.should.eql('буу');
getSlug('[Knöpfe]', {
custom: ['[', ']']
})
.should.eql('[knoepfe]');
getSlug('[Knöpfe & Ösen]', {
custom: ['[', ']']
})
.should.eql('[knoepfe-and-oesen]');
getSlug('[Knöpfe & Ösen]', {
custom: ['[', ']'],
lang: 'de'
})
.should.eql('[knoepfe-und-oesen]');
getSlug('[Knöpfe]', {
maintainCase: true,
custom: ['[', ']']
})
.should.eql('[Knoepfe]');
getSlug('[Knöpfe haben Löcher]', {
titleCase: true,
custom: ['[', ']']
})
.should.eql('[Knoepfe-Haben-Loecher]');
getSlug('[knöpfe haben runde löcher]', {
titleCase: ['haben', 'runde'],
custom: ['[', ']']
})
.should.eql('[Knoepfe-haben-runde-Loecher]');
getSlug('[knöpfe haben runde löcher]', {
titleCase: ['haben', 'runde'],
maintainCase: true,
custom: ['[', ']']
})
.should.eql('[Knoepfe-haben-runde-Loecher]');
done();
});
});

16
node_modules/speakingurl/test/test-cyrillic.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug translate cyrillic letters', function () {
'use strict';
it('should be ', function (done) {
getSlug('Пью')
.should.eql('pyu');
done();
});
});

123
node_modules/speakingurl/test/test-defaults.js generated vendored Normal file
View File

@@ -0,0 +1,123 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug defaults', function () {
'use strict';
it('should replace whitespaces with separator', function (done) {
getSlug('foo bar baz')
.should.eql('foo-bar-baz');
done();
});
it('should remove trailing space if any', function (done) {
getSlug(' foo bar baz ')
.should.eql('foo-bar-baz');
done();
});
it('should remove multiple whitespaces', function (done) {
getSlug(' foo bar baz FOO BAR BAZ ')
.should.eql('foo-bar-baz-foo-bar-baz');
done();
});
it('should remove multiple separators at start and end', function (done) {
getSlug('-foo- bar -baz-')
.should.eql('foo-bar-baz');
getSlug('--foo- bar -baz---')
.should.eql('foo-bar-baz');
getSlug('---foo- bar -baz---')
.should.eql('foo-bar-baz');
done();
});
it('should remove multple separators', function (done) {
getSlug('foo- bar -baz')
.should.eql('foo-bar-baz');
done();
});
it('should remove non-base64 characters', function (done) {
var nonBase64 = ['[', ']', ',', '*', '+', '~', '.', '(', ')', '\'', '"', '!', ':', '@'];
for (var i = 0; i < nonBase64.length; i++) {
getSlug("foo " + nonBase64[i] + " bar baz")
.should.eql("foo-bar-baz");
}
done();
});
it('should remove trailing separator', function (done) {
getSlug('C\'est un beau titre qui ne laisse rien à désirer ! ')
.should.eql(
'c-est-un-beau-titre-qui-ne-laisse-rien-a-desirer');
done();
});
it('should handle whitespace after symbol', function (done) {
getSlug('∆299')
.should.eql('delta-299');
getSlug('∆world')
.should.eql('delta-world');
getSlug('∆-299')
.should.eql('delta-299');
getSlug('∆-world')
.should.eql('delta-world');
getSlug('(∆)299')
.should.eql('delta-299');
getSlug('(∆)299', {
mark: true
})
.should.eql('(delta)299');
getSlug('∆299')
.should.eql('delta-299');
getSlug('∆world')
.should.eql('delta-world');
getSlug('Hello∆299')
.should.eql('hello-delta-299');
getSlug('299∆Hello')
.should.eql('299-delta-hello');
done();
});
it('should not fail if symbol at the end', function (done) {
getSlug('test &')
.should.eql('test-and');
getSlug('test & ')
.should.eql('test-and');
getSlug('test &', '_')
.should.eql('test_and');
getSlug('test ♥')
.should.eql('test-love');
getSlug('test ♥ ')
.should.eql('test-love');
getSlug('test ♥ ')
.should.eql('test-love');
done();
});
});

18
node_modules/speakingurl/test/test-dhivehi.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug translate dhivehi letters', function () {
'use strict';
it('should be ', function (done) {
getSlug('މއދކ ވ ރ ށ ރީތި', {
lang: 'dv'
})
.should.eql('madhk-v-r-sh-reethi');
done();
});
});

18
node_modules/speakingurl/test/test-georgien.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug translate georgien letters', function () {
'use strict';
it('should be ', function (done) {
getSlug('აბ', {
lang: 'ge'
})
.should.eql('ab');
done();
});
});

33
node_modules/speakingurl/test/test-hungarian.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug translate hungarian letters', function () {
'use strict';
it('umlaut should be single letter transliteration', function (done) {
getSlug('AÁEÉIÍOÓÖŐUÚÜŰ', {
lang: 'hu'
})
.should.eql('aaeeiioooouuuu');
getSlug('aáeéiíoóöőuúüű', {
lang: 'hu'
})
.should.eql('aaeeiioooouuuu');
getSlug('AÁEÉIÍOÓÖŐUÚÜŰ AÁEÉIÍOÓÖŐUÚÜŰ', {
lang: 'hu'
})
.should.eql('aaeeiioooouuuu-aaeeiioooouuuu');
getSlug('aáeéiíoóöőuúüű aáeéiíoóöőuúüű', {
lang: 'hu'
})
.should.eql('aaeeiioooouuuu-aaeeiioooouuuu');
done();
});
});

473
node_modules/speakingurl/test/test-lang.js generated vendored Normal file
View File

@@ -0,0 +1,473 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug symbols', function () {
'use strict';
it('should convert symbols', function (done) {
getSlug('Foo & Bar | Baz')
.should.eql('foo-and-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cs'
})
.should.eql('foo-a-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'en'
})
.should.eql('foo-and-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de'
})
.should.eql('foo-und-bar-oder-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr'
})
.should.eql('foo-et-bar-ou-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es'
})
.should.eql('foo-y-bar-u-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru'
})
.should.eql('foo-i-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ro'
})
.should.eql('foo-si-bar-sau-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk'
})
.should.eql('foo-a-bar-alebo-baz');
done();
});
it('shouldn\'t convert symbols', function (done) {
getSlug('Foo & Bar | Baz', {
symbols: false
})
.should.eql('foo-bar-baz');
getSlug('Foo & Bar | Baz', {
lang: 'en',
symbols: false
})
.should.eql('foo-bar-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de',
symbols: false
})
.should.eql('foo-bar-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr',
symbols: false
})
.should.eql('foo-bar-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es',
symbols: false
})
.should.eql('foo-bar-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru',
symbols: false
})
.should.eql('foo-bar-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cs',
symbols: false
})
.should.eql('foo-bar-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk',
symbols: false
})
.should.eql('foo-bar-baz');
done();
});
it('should not convert symbols with uric flag true', function (done) {
getSlug('Foo & Bar | Baz', {
uric: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'en',
uric: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de',
uric: true
})
.should.eql('foo-&-bar-oder-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr',
uric: true
})
.should.eql('foo-&-bar-ou-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es',
uric: true
})
.should.eql('foo-&-bar-u-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru',
uric: true
})
.should.eql('foo-&-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cs',
uric: true
})
.should.eql('foo-&-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk',
uric: true
})
.should.eql('foo-&-bar-alebo-baz');
done();
});
it('should not convert symbols with uricNoSlash flag true', function (done) {
getSlug('Foo & Bar | Baz', {
uricNoSlash: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'en',
uricNoSlash: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de',
uricNoSlash: true
})
.should.eql('foo-&-bar-oder-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr',
uricNoSlash: true
})
.should.eql('foo-&-bar-ou-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es',
uricNoSlash: true
})
.should.eql('foo-&-bar-u-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru',
uricNoSlash: true
})
.should.eql('foo-&-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cs',
uricNoSlash: true
})
.should.eql('foo-&-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk',
uricNoSlash: true
})
.should.eql('foo-&-bar-alebo-baz');
done();
});
it('should not convert symbols with mark flag true', function (done) {
getSlug('Foo (Bar) . Baz', {
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'en',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'de',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'fr',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'es',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'ru',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'cs',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'sk',
mark: true
})
.should.eql('foo-(bar)-.-baz');
done();
});
it('should convert symbols with flags true', function (done) {
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(love)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'de',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(liebe)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'fr',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(amour)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'es',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(amor)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'ru',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(lubov)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'cs',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(laska)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'sk',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(laska)-;-baz=bar');
getSlug(' Sch(* )ner (♥)Ti♥tel ♥läßt grüßen!? Bel♥♥ été !', {
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true,
maintainCase: true
})
.should.eql(
'Sch(*-)ner-(love)Ti-love-tel-love-laesst-gruessen!?-Bel-love-love-ete-!'
);
done();
});
it('should replace symbols (de)', function (done) {
getSlug('Äpfel & Birnen', {
lang: 'de'
})
.should.eql('aepfel-und-birnen');
getSlug('ÄÖÜäöüß', {
lang: 'de',
maintainCase: true
})
.should.eql('AeOeUeaeoeuess');
done();
});
it('should replace chars by cs language standards', function (done) {
getSlug(
'AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cs'
})
.should.eql(
'aaaabbccccddddeeeeeeffgghhchchiiiijjkkllmmnnnnooooppqqrrrrssssttttuuuuuuvvwwxxyyyyzzzz'
);
getSlug(
'AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cs',
maintainCase: true
})
.should.eql(
'AaAaBbCcCcDdDdEeEeEeFfGgHhChchIiIiJjKkLlMmNnNnOoOoPpQqRrRrSsSsTtTtUuUuUuVvWwXxYyYyZzZz'
);
done();
});
it('should replace chars by se language standards', function (done) {
getSlug(
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzÅåÄäÖö', {
lang: 'sv',
maintainCase: true
})
.should.eql(
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzAaAaOo'
);
done();
});
it('should replace chars by fi language standards', function (done) {
getSlug(
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzÅåÄäÖö', {
lang: 'fi',
maintainCase: true
})
.should.eql(
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZzAaAaOo'
);
done();
});
it('should replace chars by sk language standards', function (done) {
getSlug(
'AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk'
})
.should.eql(
'aaaaaabbccccdddddzdzdzdzeeeeffgghhchchiiiijjkkllllllmmnnnnooooooppqqrrrrssssttttuuuuvvwwxxyyyyzzzz'
);
getSlug(
'AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk',
maintainCase: true
})
.should.eql(
'AaAaAaBbCcCcDdDdDzdzDzdzEeEeFfGgHhChchIiIiJjKkLlLlLlMmNnNnOoOoOoPpQqRrRrSsSsTtTtUuUuVvWwXxYyYyZzZz'
);
done();
});
it('should ignore not available language param', function (done) {
getSlug('Äpfel & Birnen', {
lang: 'xx'
})
.should.eql('aepfel-and-birnen');
done();
});
it('should convert currency symbols to lowercase', function (done) {
getSlug('NEXUS4 only €199!', {
maintainCase: false
})
.should.eql('nexus4-only-eur199');
getSlug('NEXUS4 only €299.93', {
maintainCase: false
})
.should.eql('nexus4-only-eur299-93');
getSlug('NEXUS4 only 円399.73', {
maintainCase: false
})
.should.eql('nexus4-only-yen399-73');
done();
});
it('should convert currency symbols to uppercase', function (done) {
getSlug('NEXUS4 only €199!', {
maintainCase: true
})
.should.eql('NEXUS4-only-EUR199');
getSlug('NEXUS4 only €299.93', {
maintainCase: true
})
.should.eql('NEXUS4-only-EUR299-93');
getSlug('NEXUS4 only 円399.73', {
maintainCase: true
})
.should.eql('NEXUS4-only-YEN399-73');
done();
});
});

304
node_modules/speakingurl/test/test-language.js generated vendored Normal file
View File

@@ -0,0 +1,304 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug languages', function () {
'use strict';
it('should replace language specific symbols', function (done) {
var symbolMap = {
'ar': {
'∆': 'delta',
'∞': 'la-nihaya',
'♥': 'hob',
'&': 'wa',
'|': 'aw',
'<': 'aqal-men',
'>': 'akbar-men',
'∑': 'majmou',
'¤': 'omla'
},
'cs': {
'∆': 'delta',
'∞': 'nekonecno',
'♥': 'laska',
'&': 'a',
'|': 'nebo',
'<': 'mensi nez',
'>': 'vetsi nez',
'∑': 'soucet',
'¤': 'mena'
},
'de': {
'∆': 'delta',
'∞': 'unendlich',
'♥': 'Liebe',
'&': 'und',
'|': 'oder',
'<': 'kleiner als',
'>': 'groesser als',
'∑': 'Summe von',
'¤': 'Waehrung'
},
'en': {
'∆': 'delta',
'∞': 'infinity',
'♥': 'love',
'&': 'and',
'|': 'or',
'<': 'less than',
'>': 'greater than',
'∑': 'sum',
'¤': 'currency'
},
'es': {
'∆': 'delta',
'∞': 'infinito',
'♥': 'amor',
'&': 'y',
'|': 'u',
'<': 'menos que',
'>': 'mas que',
'∑': 'suma de los',
'¤': 'moneda'
},
'fr': {
'∆': 'delta',
'∞': 'infiniment',
'♥': 'Amour',
'&': 'et',
'|': 'ou',
'<': 'moins que',
'>': 'superieure a',
'∑': 'somme des',
'¤': 'monnaie'
},
'hu': {
'∆': 'delta',
'∞': 'vegtelen',
'♥': 'szerelem',
'&': 'es',
'|': 'vagy',
'<': 'kisebb mint',
'>': 'nagyobb mint',
'∑': 'szumma',
'¤': 'penznem'
},
'my': {
'∆': 'kwahkhyaet',
'∞': 'asaonasme',
'♥': 'akhyait',
'&': 'nhin',
'|': 'tho',
'<': 'ngethaw',
'>': 'kyithaw',
'∑': 'paungld',
'¤': 'ngwekye'
},
'nl': {
'∆': 'delta',
'∞': 'oneindig',
'♥': 'liefde',
'&': 'en',
'|': 'of',
'<': 'kleiner dan',
'>': 'groter dan',
'∑': 'som',
'¤': 'valuta'
},
'it': {
'∆': 'delta',
'∞': 'infinito',
'♥': 'amore',
'&': 'e',
'|': 'o',
'<': 'minore di',
'>': 'maggiore di',
'∑': 'somma',
'¤': 'moneta'
},
'pl': {
'∆': 'delta',
'∞': 'nieskonczonosc',
'♥': 'milosc',
'&': 'i',
'|': 'lub',
'<': 'mniejsze niz',
'>': 'wieksze niz',
'∑': 'suma',
'¤': 'waluta'
},
'pt': {
'∆': 'delta',
'∞': 'infinito',
'♥': 'amor',
'&': 'e',
'|': 'ou',
'<': 'menor que',
'>': 'maior que',
'∑': 'soma',
'¤': 'moeda'
},
'ru': {
'∆': 'delta',
'∞': 'beskonechno',
'♥': 'lubov',
'&': 'i',
'|': 'ili',
'<': 'menshe',
'>': 'bolshe',
'∑': 'summa',
'¤': 'valjuta'
},
'sk': {
'∆': 'delta',
'∞': 'nekonecno',
'♥': 'laska',
'&': 'a',
'|': 'alebo',
'<': 'menej ako',
'>': 'viac ako',
'∑': 'sucet',
'¤': 'mena'
},
'tr': {
'∆': 'delta',
'∞': 'sonsuzluk',
'♥': 'ask',
'&': 've',
'|': 'veya',
'<': 'kucuktur',
'>': 'buyuktur',
'∑': 'toplam',
'¤': 'para birimi'
},
'vn': {
'∆': 'delta',
'∞': 'vo cuc',
'♥': 'yeu',
'&': 'va',
'|': 'hoac',
'<': 'nho hon',
'>': 'lon hon',
'∑': 'tong',
'¤': 'tien te'
}
};
Object.keys(symbolMap)
.forEach(function (l) {
// console.log('\ncheck language: ' + l);
Object.keys(symbolMap[l])
.forEach(function (s) {
var k = symbolMap[l][s];
// console.log('check symbol: ' + s);
getSlug('Foo ' + s + ' Bar', {
lang: l,
maintainCase: true
})
.should.eql('Foo-' + getSlug(k, {
maintainCase: true
}) + '-Bar');
getSlug('Foo ' + s + ' Bar', {
lang: l
})
.should.eql('foo-' + getSlug(k) + '-bar');
});
});
getSlug('EN Foo & Bar ')
.should.eql('en-foo-and-bar');
getSlug('EN Foo & Bar ', {
lang: "en"
})
.should.eql('en-foo-and-bar');
getSlug('de Foo & Bar ', {
lang: "de"
})
.should.eql('de-foo-und-bar');
getSlug('True Foo & Bar ', {
lang: true
})
.should.eql('true-foo-and-bar');
getSlug('False Foo & Bar ', {
lang: false
})
.should.eql('false-foo-bar');
getSlug('False Foo & Bar ', {
lang: false,
symbols: true
})
.should.eql('false-foo-bar');
getSlug('xx Foo & Bar ', {
lang: "xx"
})
.should.eql('xx-foo-and-bar');
getSlug('obj Foo & Bar ', {
lang: {}
})
.should.eql('obj-foo-and-bar');
getSlug('array Foo & Bar ', {
lang: []
})
.should.eql('array-foo-and-bar');
getSlug('array Foo & Bar ', {
lang: [],
symbols: false
})
.should.eql('array-foo-bar');
getSlug('null Foo & Bar ', {
lang: null
})
.should.eql('null-foo-and-bar');
getSlug('null Foo & Bar ', {
lang: null,
symbols: false
})
.should.eql('null-foo-bar');
getSlug('null Foo & Bar ', {
lang: null,
symbols: true
})
.should.eql('null-foo-and-bar');
done();
});
});

32
node_modules/speakingurl/test/test-maintaincase.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug maintainCase', function () {
'use strict';
it('should maintain case characters', function (done) {
getSlug('Foo, Bar Baz', {
maintainCase: true
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo- Bar Baz', {
maintainCase: true
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo] Bar Baz', {
maintainCase: true
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo > Bar ♥ Baz', {
maintainCase: true
})
.should.eql('Foo-greater-than-Bar-love-Baz');
done();
});
});

16
node_modules/speakingurl/test/test-persian.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
var getSlug = require('../lib/speakingurl');
describe('getSlug translate persian letters/numbers', function () {
'use strict';
it('should be ', function (done) {
getSlug('گ چ پ ژ ک ی ۰ ۱ ۲ ۳ ۴ ۵ ۶ ۷ ۸ ۹', {
lang: 'fa'
})
.should.eql('g-ch-p-zh-k-y-0-1-2-3-4-5-6-7-8-9');
done();
});
});

128
node_modules/speakingurl/test/test-rfc3986.js generated vendored Normal file
View File

@@ -0,0 +1,128 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug rfc3986', function () {
'use strict';
it('"uric" characters allowed', function (done) {
var chars = [';', '?', ':', '@', '&', '=', '+', ',', '/'];
for (var i = 0; i < chars.length; i++) {
getSlug("foo " + chars[i] + " bar baz", {
uric: true
})
.should.eql("foo-" + chars[i] + "-bar-baz");
}
done();
});
it('"uricNoSlash" characters allowed', function (done) {
var chars = [';', '?', ':', '@', '&', '=', '+', ','];
for (var i = 0; i < chars.length; i++) {
getSlug("foo " + chars[i] + " bar baz", {
uricNoSlash: true
})
.should.eql("foo-" + chars[i] + "-bar-baz");
}
done();
});
it('"mark" characters allowed', function (done) {
var chars = ['.', '!', '~', '*', '\'', '(', ')'];
for (var i = 0; i < chars.length; i++) {
getSlug("foo " + chars[i] + " bar baz", {
mark: true
})
.should.eql("foo-" + chars[i] + "-bar-baz");
}
done();
});
it('"uric" characters allowed, separator ";"', function (done) {
var chars = ['?', ':', '@', '&', '=', '+', ',', '/'];
for (var i = 0; i < chars.length; i++) {
getSlug("foo " + chars[i] + " bar baz", {
uric: true,
separator: ';'
})
.should.eql("foo;" + chars[i] + ";bar;baz");
}
done();
});
it('"uric" characters allowed, separator ";" included in input string', function (done) {
getSlug("foo ; bar baz", {
uric: true,
separator: ';'
})
.should.eql("foo;bar;baz");
done();
});
it('"uricNoSlash" characters allowed, separator ";"', function (done) {
var chars = ['?', ':', '@', '&', '=', '+', ','];
for (var i = 0; i < chars.length; i++) {
getSlug("foo " + chars[i] + " bar baz", {
uricNoSlash: true,
separator: ';'
})
.should.eql("foo;" + chars[i] + ";bar;baz");
}
done();
});
it('"uricNoSlash" characters allowed, separator ";" included in input string', function (done) {
getSlug("foo ; bar baz", {
uric: true,
separator: ';'
})
.should.eql("foo;bar;baz");
done();
});
it('"mark" characters allowed, separator "."', function (done) {
var chars = ['!', '~', '*', '\'', '(', ')'];
for (var i = 0; i < chars.length; i++) {
getSlug("foo " + chars[i] + " bar baz", {
mark: true,
separator: '.'
})
.should.eql("foo." + chars[i] + ".bar.baz");
}
done();
});
it('"mark" characters allowed, separator "." included in input string', function (done) {
getSlug("foo . bar baz", {
uric: true,
separator: '.'
})
.should.eql("foo.bar.baz");
done();
});
});

181
node_modules/speakingurl/test/test-separator.js generated vendored Normal file
View File

@@ -0,0 +1,181 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug separator', function () {
'use strict';
it('should separate with non-whitespace', function (done) {
getSlug('Foo Bar Baz', {
separator: '-'
})
.should.eql('foo-bar-baz');
getSlug('Foo Bar Baz', {
separator: '*'
})
.should.eql('foo*bar*baz');
getSlug('Foo Bar Baz', {
separator: '_'
})
.should.eql('foo_bar_baz');
getSlug('Foo Bar Baz', '-')
.should.eql('foo-bar-baz');
getSlug('Foo Bar Baz', '*')
.should.eql('foo*bar*baz');
getSlug('Foo Bar Baz', '_')
.should.eql('foo_bar_baz');
done();
});
it('should separate with non-whitespace, with trailing spaces', function (done) {
getSlug(' Foo Bar Baz ', {
separator: '-'
})
.should.eql('foo-bar-baz');
getSlug(' Foo Bar Baz ', {
separator: '*'
})
.should.eql('foo*bar*baz');
getSlug(' Foo Bar Baz ', {
separator: '_'
})
.should.eql('foo_bar_baz');
getSlug(' Foo Bar Baz ', '-')
.should.eql('foo-bar-baz');
getSlug(' Foo Bar Baz ', '*')
.should.eql('foo*bar*baz');
getSlug(' Foo Bar Baz ', '_')
.should.eql('foo_bar_baz');
done();
});
it('should separate with trailing separator "-"', function (done) {
getSlug('-Foo Bar Baz-', {
separator: '-'
})
.should.eql('foo-bar-baz');
getSlug('--Foo Bar Baz---', {
separator: '-'
})
.should.eql('foo-bar-baz');
getSlug('---Foo Bar Baz---', {
separator: '-'
})
.should.eql('foo-bar-baz');
getSlug('-Foo Bar Baz-', '-')
.should.eql('foo-bar-baz');
getSlug('--Foo Bar Baz---', '-')
.should.eql('foo-bar-baz');
getSlug('---Foo Bar Baz---', '-')
.should.eql('foo-bar-baz');
done();
});
it('should separate with trailing separator "*"', function (done) {
getSlug('*Foo Bar Baz*', {
separator: '*'
})
.should.eql('foo*bar*baz');
getSlug('**Foo Bar Baz**', {
separator: '*'
})
.should.eql('foo*bar*baz');
getSlug('***Foo Bar Baz***', {
separator: '*'
})
.should.eql('foo*bar*baz');
getSlug('*Foo Bar Baz*', '*')
.should.eql('foo*bar*baz');
getSlug('**Foo Bar Baz**', '*')
.should.eql('foo*bar*baz');
getSlug('***Foo Bar Baz***', '*')
.should.eql('foo*bar*baz');
done();
});
it('should separate with trailing separator "_"', function (done) {
getSlug('_Foo Bar Baz_', {
separator: '_'
})
.should.eql('foo_bar_baz');
getSlug('__Foo Bar Baz__', {
separator: '_'
})
.should.eql('foo_bar_baz');
getSlug('___Foo Bar Baz___', {
separator: '_'
})
.should.eql('foo_bar_baz');
getSlug('_Foo Bar Baz_', '_')
.should.eql('foo_bar_baz');
getSlug('__Foo Bar Baz__', '_')
.should.eql('foo_bar_baz');
getSlug('___Foo Bar Baz___', '_')
.should.eql('foo_bar_baz');
done();
});
it('should remove trailing separator "*"', function (done) {
getSlug(' C\'est un beau titre qui ne laisse rien à désirer !', {
separator: '*'
})
.should.eql(
'c*est*un*beau*titre*qui*ne*laisse*rien*a*desirer');
getSlug(' C\'est un beau titre qui ne laisse rien à désirer !',
'*')
.should.eql(
'c*est*un*beau*titre*qui*ne*laisse*rien*a*desirer');
done();
});
it('should return empty string because of non string input', function (done) {
getSlug(true)
.should.eql('');
done();
});
});

197
node_modules/speakingurl/test/test-speakingurl.js generated vendored Normal file
View File

@@ -0,0 +1,197 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug config combinations', function () {
'use strict';
it('should separate with configured character, with non-Base64 separator', function (done) {
getSlug('Foo, Bar Baz', {
separator: '*',
maintainCase: false
})
.should.eql('foo*bar*baz');
getSlug('Foo- Bar Baz', {
separator: '*',
maintainCase: false
})
.should.eql('foo-*bar*baz');
getSlug('Foo] Bar Baz', {
separator: '*',
maintainCase: false
})
.should.eql('foo*bar*baz');
done();
});
it('should separate with configured character, with only Base64 characters allowed', function (done) {
getSlug('Foo, Bar Baz', {
separator: '_',
onlyBase64: true
})
.should.eql('foo_bar_baz');
getSlug('Foo- Bar Baz', {
separator: '_',
onlyBase64: true
})
.should.eql('foo-_bar_baz');
getSlug('Foo] Bar Baz', {
separator: '_',
onlyBase64: true
})
.should.eql('foo_bar_baz');
done();
});
it('should separate with configured character, with smart trim', function (done) {
getSlug('Foobarbaz, Bar Baz', {
separator: '_',
truncate: 12
})
.should.eql('foobarbaz');
getSlug('Foobarbaz, Bar Baz', {
separator: '_',
truncate: 15
})
.should.eql('foobarbaz_bar');
getSlug(' Foobarbaz, Bar Baz', {
separator: '_',
truncate: 15
})
.should.eql('foobarbaz_bar');
getSlug(' Foobarbaz, Bar Baz', {
separator: '_',
truncate: 15
})
.should.eql('foobarbaz_bar');
done();
});
it('should maintain case characters, with non-Base64 separator', function (done) {
getSlug('Foo, Bar Baz', {
maintainCase: true,
separator: '*'
})
.should.eql('Foo*Bar*Baz');
getSlug('Foo- Bar Baz', {
maintainCase: true,
separator: '*'
})
.should.eql('Foo-*Bar*Baz');
getSlug('Foo] Bar Baz', {
maintainCase: true,
separator: '*'
})
.should.eql('Foo*Bar*Baz');
done();
});
it('should maintain case characters, with only Base64 characters allowed', function (done) {
getSlug('Foo, Bar Baz', {
maintainCase: true,
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo- Bar Baz', {
maintainCase: true,
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('Foo-Bar-Baz');
getSlug('Foo] Bar Baz', {
maintainCase: true,
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('Foo-Bar-Baz');
done();
});
it('should maintain case characters, with smart trim', function (done) {
getSlug('Foobarbaz, Bar Baz', {
maintainCase: true,
truncate: 12
})
.should.eql('Foobarbaz');
getSlug('Foobarbaz, Bar Baz', {
maintainCase: true,
truncate: 15
})
.should.eql('Foobarbaz-Bar');
getSlug(' Foobarbaz, Bar Baz', {
maintainCase: true,
truncate: 15
})
.should.eql('Foobarbaz-Bar');
getSlug(' Foobarbaz, Bar Baz', {
maintainCase: true,
truncate: 15
})
.should.eql('Foobarbaz-Bar');
done();
});
it('should prefer Base64 characters only', function (done) {
getSlug('Foo, Bar Baz', {
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('foo-bar-baz');
getSlug('Foo- Bar Baz', {
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('foo-bar-baz');
getSlug('Foo] Bar Baz', {
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('foo-bar-baz');
getSlug('Foo* Bar Baz', {
uric: false,
uricNoSlash: false,
mark: false
})
.should.eql('foo-bar-baz');
done();
});
});

506
node_modules/speakingurl/test/test-symbols.js generated vendored Normal file
View File

@@ -0,0 +1,506 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug symbols', function () {
'use strict';
it('should convert symbols', function (done) {
getSlug('Foo & Bar | Baz')
.should.eql('foo-and-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'en'
})
.should.eql('foo-and-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de'
})
.should.eql('foo-und-bar-oder-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr'
})
.should.eql('foo-et-bar-ou-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es'
})
.should.eql('foo-y-bar-u-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru'
})
.should.eql('foo-i-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cs'
})
.should.eql('foo-a-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk'
})
.should.eql('foo-a-bar-alebo-baz');
done();
});
it('should not convert symbols with uric flag true', function (done) {
getSlug('Foo & Bar | Baz', {
uric: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'en',
uric: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de',
uric: true
})
.should.eql('foo-&-bar-oder-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr',
uric: true
})
.should.eql('foo-&-bar-ou-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es',
uric: true
})
.should.eql('foo-&-bar-u-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru',
uric: true
})
.should.eql('foo-&-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cs',
uric: true
})
.should.eql('foo-&-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk',
uric: true
})
.should.eql('foo-&-bar-alebo-baz');
done();
});
it('should not convert symbols with uricNoSlash flag true', function (done) {
getSlug('Foo & Bar | Baz', {
uricNoSlash: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'en',
uricNoSlash: true
})
.should.eql('foo-&-bar-or-baz');
getSlug('Foo & Bar | Baz', {
lang: 'de',
uricNoSlash: true
})
.should.eql('foo-&-bar-oder-baz');
getSlug('Foo & Bar | Baz', {
lang: 'fr',
uricNoSlash: true
})
.should.eql('foo-&-bar-ou-baz');
getSlug('Foo & Bar | Baz', {
lang: 'es',
uricNoSlash: true
})
.should.eql('foo-&-bar-u-baz');
getSlug('Foo & Bar | Baz', {
lang: 'ru',
uricNoSlash: true
})
.should.eql('foo-&-bar-ili-baz');
getSlug('Foo & Bar | Baz', {
lang: 'cs',
uricNoSlash: true
})
.should.eql('foo-&-bar-nebo-baz');
getSlug('Foo & Bar | Baz', {
lang: 'sk',
uricNoSlash: true
})
.should.eql('foo-&-bar-alebo-baz');
done();
});
it('should not convert symbols with mark flag true', function (done) {
getSlug('Foo (Bar) . Baz', {
mark: true,
symbols: false
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'en',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . & Baz', {
lang: 'en',
mark: true
})
.should.eql('foo-(bar)-.-and-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'de',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'fr',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'es',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'ru',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'cs',
mark: true
})
.should.eql('foo-(bar)-.-baz');
getSlug('Foo (Bar) . Baz', {
lang: 'sk',
mark: true
})
.should.eql('foo-(bar)-.-baz');
done();
});
it('should convert symbols with flags true', function (done) {
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(love)-;-baz=bar');
getSlug('Foo (♥) ; Baz=& Bar', {
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(love)-;-baz=&-bar');
getSlug('Foo (♥) ; Baz=& Bar', {
lang: 'en',
mark: true
})
.should.eql('foo-(love)-baz-and-bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'de',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(liebe)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'fr',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(amour)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'es',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(amor)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'ru',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(lubov)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'cs',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(laska)-;-baz=bar');
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'sk',
uric: true,
uricNoSlash: true,
mark: true
})
.should.eql('foo-(laska)-;-baz=bar');
getSlug(' Sch(* )ner (♥)Ti♥tel ♥läßt grüßen!? Bel♥♥ été !', {
lang: 'en',
uric: true,
uricNoSlash: true,
mark: true,
maintainCase: true
})
.should.eql(
'Sch(*-)ner-(love)Ti-love-tel-love-laesst-gruessen!?-Bel-love-love-ete-!'
);
done();
});
it('should not convert symbols with flags true', function (done) {
getSlug('Foo (♥) ; Baz=Bar', {
lang: 'en',
mark: true,
symbols: false
})
.should.eql('foo-(-)-baz-bar');
getSlug('Foo (♥) ; Baz=& Bar', {
lang: 'en',
mark: true,
symbols: false
})
.should.eql('foo-(-)-baz-bar');
getSlug('Foo (♥) ; Baz=& Bar', {
lang: 'en',
mark: true,
symbols: false
})
.should.eql('foo-(-)-baz-bar');
getSlug('Foo (♥) ; Baz= & Bar', {
lang: 'de',
mark: true,
symbols: false
})
.should.eql('foo-(-)-baz-bar');
getSlug('Foo (♥) ; Baz=& Bar', {
lang: 'fr',
mark: true,
symbols: false
})
.should.eql('foo-(-)-baz-bar');
getSlug('Foo (♥) ; Baz=& Bar', {
lang: 'es',
mark: true,
symbols: false
})
.should.eql('foo-(-)-baz-bar');
getSlug('Foo (♥) ; Baz=& Bar', {
lang: 'ru',
mark: true,
symbols: false
})
.should.eql('foo-(-)-baz-bar');
getSlug('Foo (♥) ; Baz=& Bar', {
lang: 'cs',
mark: true,
symbols: false
})
.should.eql('foo-(-)-baz-bar');
getSlug('Foo (♥) ; Baz=& Bar', {
lang: 'sk',
mark: true,
symbols: false
})
.should.eql('foo-(-)-baz-bar');
getSlug(' Sch(* )ner (♥)Ti♥tel ♥läßt grüßen!? Bel♥♥ été !', {
lang: 'en',
mark: true,
maintainCase: true,
symbols: false
})
.should.eql(
'Sch(*-)ner-(-)Ti-tel-laesst-gruessen!-Bel-ete-!'
);
done();
});
it('should replace symbols (de)', function (done) {
getSlug('Äpfel & Birnen', {
lang: 'de'
})
.should.eql('aepfel-und-birnen');
getSlug('ÄÖÜäöüß', {
lang: 'de',
maintainCase: true
})
.should.eql('AeOeUeaeoeuess');
done();
});
it('should not replace symbols (de)', function (done) {
getSlug('Äpfel & Birnen', {
lang: 'de',
symbols: false
})
.should.eql('aepfel-birnen');
getSlug('ÄÖÜäöüß & Äpfel', {
lang: 'de',
maintainCase: true,
symbols: false
})
.should.eql('AeOeUeaeoeuess-Aepfel');
done();
});
it('should replace chars by cs language standards', function (done) {
getSlug(
'AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cs'
})
.should.eql(
'aaaabbccccddddeeeeeeffgghhchchiiiijjkkllmmnnnnooooppqqrrrrssssttttuuuuuuvvwwxxyyyyzzzz'
);
getSlug(
'AaÁáBbCcČčDdĎďEeÉéĚěFfGgHhChchIiÍíJjKkLlMmNnŇňOoÓóPpQqRrŘřSsŠšTtŤťUuÚúŮůVvWwXxYyÝýZzŽž', {
lang: 'cs',
maintainCase: true
})
.should.eql(
'AaAaBbCcCcDdDdEeEeEeFfGgHhChchIiIiJjKkLlMmNnNnOoOoPpQqRrRrSsSsTtTtUuUuUuVvWwXxYyYyZzZz'
);
done();
});
it('should replace chars by sk language standards', function (done) {
getSlug(
'AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk'
})
.should.eql(
'aaaaaabbccccdddddzdzdzdzeeeeffgghhchchiiiijjkkllllllmmnnnnooooooppqqrrrrssssttttuuuuvvwwxxyyyyzzzz'
);
getSlug(
'AaÁaÄäBbCcČčDdĎďDzdzDždžEeÉéFfGgHhChchIiÍíJjKkLlĹ弾MmNnŇňOoÓóÔôPpQqRrŔŕSsŠšTtŤťUuÚúVvWwXxYyÝýZzŽž', {
lang: 'sk',
maintainCase: true
})
.should.eql(
'AaAaAaBbCcCcDdDdDzdzDzdzEeEeFfGgHhChchIiIiJjKkLlLlLlMmNnNnOoOoOoPpQqRrRrSsSsTtTtUuUuVvWwXxYyYyZzZz'
);
done();
});
it('should ignore not available language param', function (done) {
getSlug('Äpfel & Birnen', {
lang: 'xx'
})
.should.eql('aepfel-and-birnen');
done();
});
it('should convert currency symbols to lowercase', function (done) {
getSlug('NEXUS4 only €199!', {
maintainCase: false
})
.should.eql('nexus4-only-eur199');
getSlug('NEXUS4 only €299.93', {
maintainCase: false
})
.should.eql('nexus4-only-eur299-93');
getSlug('NEXUS4 only 円399.73', {
maintainCase: false
})
.should.eql('nexus4-only-yen399-73');
done();
});
it('should convert currency symbols to uppercase', function (done) {
getSlug('NEXUS4 only €199!', {
maintainCase: true
})
.should.eql('NEXUS4-only-EUR199');
getSlug('NEXUS4 only €299.93', {
maintainCase: true
})
.should.eql('NEXUS4-only-EUR299-93');
getSlug('NEXUS4 only 円399.73', {
maintainCase: true
})
.should.eql('NEXUS4-only-YEN399-73');
done();
});
});

69
node_modules/speakingurl/test/test-titlecase.js generated vendored Normal file
View File

@@ -0,0 +1,69 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug titleCase', function () {
'use strict';
it('should title-case the characters', function (done) {
getSlug('This is big foo', {
titleCase: true
})
.should.eql('This-Is-Big-Foo');
getSlug('This is Big foo', {
titleCase: true
})
.should.eql('This-Is-Big-Foo');
getSlug('Don\'t drink and drive', {
titleCase: true
})
.should.eql('Don-t-Drink-And-Drive');
done();
});
it('should title-case the characters with custom array', function (done) {
getSlug('This is yet foo and bar', {
titleCase: ['and', 'yet']
})
.should.eql('This-Is-yet-Foo-and-Bar');
getSlug('This is a foo and an angry bird', {
titleCase: ['a', 'an', 'and']
})
.should.eql('This-Is-a-Foo-and-an-Angry-Bird');
getSlug('This is a foo and an angry bird show', {
titleCase: ['a']
})
.should.eql('This-Is-a-Foo-And-An-Angry-Bird-Show');
getSlug('Don\'t drink and drive', {
titleCase: ['and']
})
.should.eql('Don-t-Drink-and-Drive');
getSlug('Don\'t drink and drive', {
titleCase: {}
})
.should.eql('Don-t-Drink-And-Drive');
getSlug('Don\'t drink and drive', {
titleCase: {
'drink': 'drive'
}
})
.should.eql('Don-t-Drink-And-Drive');
getSlug('Don\'t drink and drive', {
titleCase: 42
})
.should.eql('Don-t-Drink-And-Drive');
done();
});
});

68
node_modules/speakingurl/test/test-truncate.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug smart truncate', function () {
'use strict';
it('should maintain case characters, with smart truncate', function (done) {
getSlug('Foobarbaz, Bar Baz', {
truncate: 12
})
.should.eql('foobarbaz');
getSlug('Foobarbaz, Bar Baz', {
truncate: 15
})
.should.eql('foobarbaz-bar');
getSlug(' Foobarbaz, Bar Baz', {
truncate: 15
})
.should.eql('foobarbaz-bar');
getSlug(' Foobarbaz, Bar Baz', {
truncate: 15
})
.should.eql('foobarbaz-bar');
getSlug('Foo Foo bar Zoo Bar Baz', {
truncate: 15
})
.should.eql('foo-foo-bar-zoo');
getSlug('Foo Foo bar ZooBar Baz', {
truncate: 15
})
.should.eql('foo-foo-bar');
getSlug('Foo Foo bar ZooBar Baz', {
truncate: 15
})
.should.eql('foo-foo-bar');
getSlug('Foo Foo Bar Bar', {
truncate: "foo"
})
.should.eql('foo-foo-bar-bar');
getSlug('Foo Foo Bar Bar', {
truncate: false
})
.should.eql('foo-foo-bar-bar');
getSlug('Foo Foo Bar Bar', {
truncate: true
})
.should.eql('foo-foo-bar-bar');
getSlug('a Foo', {
truncate: true
})
.should.eql('a-foo');
done();
});
});

23
node_modules/speakingurl/test/test-turkish.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
/* global describe,it */
var getSlug = require('../lib/speakingurl');
describe('getSlug translate turkish letters', function () {
'use strict';
it('umlaut should be single letter transliteration', function (done) {
getSlug('ÜÄÖüäö', {
lang: 'tr'
})
.should.eql('uaeouaeo');
getSlug('ÜÖÄ äüö', {
lang: 'tr'
})
.should.eql('uoae-aeuo');
done();
});
});