wraith/node_modules/speakingurl/test/test-custom.js
Vantz Stockwell 2848d79915 feat: Phase 1 complete — Tauri v2 foundation
Rust backend: SQLite (WAL mode, 8 tables), vault encryption
(Argon2id + AES-256-GCM), settings/connections/credentials
services, 19 Tauri command wrappers. 46/46 tests passing.

Vue 3 frontend: unlock/create vault flow, Pinia app store,
Tailwind CSS v4 dark theme with Wraith branding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 15:09:41 -04:00

98 lines
2.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* 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();
});
});