Files
BetterDesk/web-nodejs/tests/envMerge.test.js
UNITRONIX 8b916488b9 Complete web console i18n audit and refine server attestation.
Sync all 26 locale files to the EN+PL baseline (3432 keys), add OBSIDIAN tier strings, and ship i18n apply/audit tooling. Improve server attestation UX and convert orphaned node:test scripts to Jest so the full test suite passes.
2026-06-06 02:36:57 +02:00

29 lines
890 B
JavaScript

'use strict';
const { mergeEnv, applySubstitutions } = require('../lib/envMerge');
describe('envMerge', () => {
it('preserves existing keys and appends missing template keys', () => {
const existing = `# custom
MY_FEATURE=true
PORT=5000
SESSION_SECRET=keep-me
`;
const template = applySubstitutions(`PORT=5000
HOST=0.0.0.0
TRUST_PROXY=false
SESSION_SECRET=__SESSION_SECRET__
`, { SESSION_SECRET: 'new-should-not-apply' });
const { content, added } = mergeEnv(existing, template);
expect(content).toContain('MY_FEATURE=true');
expect(content).toContain('SESSION_SECRET=keep-me');
expect(content).toContain('HOST=0.0.0.0');
expect(content).toContain('TRUST_PROXY=false');
expect(added).toContain('HOST');
expect(added).toContain('TRUST_PROXY');
expect(added).not.toContain('SESSION_SECRET');
});
});