Files
BetterDesk/web-nodejs/tests/fontService.test.js
T
UNITRONIX 253a126888 chore: remove outdated build workflow and update CI configurations
Deleted the obsolete build workflow for BetterDesk and made adjustments to the CI configurations across multiple workflows. This includes changing permissions from write to read in the release-client and secret-scan workflows, updating the Node.js setup in the web-nodejs CI, and enhancing the rate limiting for RdClient pages. Additionally, improved the handling of return URLs in the auth middleware and added new utility functions for better security and logging.
2026-06-20 18:08:54 +02:00

27 lines
896 B
JavaScript

/**
* BetterDesk Console - Font Service Tests
*/
'use strict';
const fontService = require('../services/fontService');
describe('fontService security helpers', () => {
it('escapes CSS string metacharacters in font families', () => {
const escaped = fontService.escapeCssString("Bad');}\nbody{color:red}\\Font");
expect(escaped).toContain("\\'");
expect(escaped).toContain('\\a ');
expect(escaped).toContain('\\\\');
expect(escaped).not.toContain('\n');
});
it('uses escaped font families in generated branding CSS', () => {
const css = fontService.generateFontCss("Heading');}\nbody{color:red}", "Body\\Font");
expect(css).toContain("--font-heading: 'Heading\\');}\\a body{color:red}'");
expect(css).toContain("--font-family: 'Body\\\\Font'");
expect(css).not.toContain('\nbody{color:red}');
});
});