mirror of
https://github.com/UNITRONIX/BetterDesk.git
synced 2026-09-10 17:45:42 +00:00
e7215f2f9d
- Introduced new localization strings for short download links and their hints in various languages. - Added validation messages for short link requirements, including character restrictions and length constraints. - Updated existing download link hints to inform users that old hex links will continue to function after changes to short links. - Ensured consistency across all language files to enhance user experience and clarity in the interface.
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const bundleService = require('../services/agentBundleService');
|
|
|
|
describe('agentBundle slug helpers', () => {
|
|
it('slugifyName transliterates Polish and normalizes separators', () => {
|
|
expect(bundleService.slugifyName('Moja Firma IT')).toBe('moja-firma-it');
|
|
expect(bundleService.slugifyName(' Łódź & Warszawa ')).toBe('lodz-warszawa');
|
|
});
|
|
|
|
it('validateSlug enforces length and charset', () => {
|
|
expect(bundleService.validateSlug('acme').valid).toBe(true);
|
|
expect(bundleService.validateSlug('a').valid).toBe(false);
|
|
expect(bundleService.validateSlug('ACME').valid).toBe(false);
|
|
expect(bundleService.validateSlug('acme_').valid).toBe(false);
|
|
});
|
|
|
|
it('allocateUniqueSlug appends numeric suffix on collision', () => {
|
|
const taken = new Set(['acme']);
|
|
const slug = bundleService.allocateUniqueSlug({
|
|
preferred: 'acme',
|
|
name: 'Acme',
|
|
fallbackId: 'deadbeefcafe',
|
|
isTaken: (s) => taken.has(s),
|
|
});
|
|
expect(slug).toBe('acme-2');
|
|
});
|
|
|
|
it('publicBundleId prefers slug over legacy bundle id', () => {
|
|
expect(bundleService.publicBundleId({ slug: 'acme', bundle_id: 'c853d6ae677f' })).toBe('acme');
|
|
expect(bundleService.publicBundleId({ bundle_id: 'c853d6ae677f' })).toBe('c853d6ae677f');
|
|
});
|
|
});
|