Add advanced Git and deployment workflows, secure backups and auditing, live Gitea integration, desktop notifications, connection validation, and the premium responsive UX refresh.
23 lines
948 B
JavaScript
23 lines
948 B
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import validation from '../src/shared/validation.cjs';
|
|
|
|
const { normalizeBaseUrl, assertCommitMessage, assertDeploymentRequest, assertHttpUrl } = validation;
|
|
|
|
test('normalizes Gitea base URL', () => {
|
|
assert.equal(normalizeBaseUrl('https://gitea.example.com/'), 'https://gitea.example.com');
|
|
});
|
|
|
|
test('rejects blank commit messages', () => {
|
|
assert.throws(() => assertCommitMessage(' '), /commit message/i);
|
|
});
|
|
|
|
test('requires exact SHA and workflow profile', () => {
|
|
assert.throws(() => assertDeploymentRequest({ branch: 'main', workflowFile: 'deploy.yml' }, 'nope'), /commit SHA/i);
|
|
});
|
|
|
|
test('accepts Unraid DockerMan WebUI placeholders only when explicitly enabled', () => {
|
|
assert.equal(assertHttpUrl('http://[IP]:[PORT:1223]/', { allowUnraidTemplate: true }), 'http://[IP]:[PORT:1223]/');
|
|
assert.throws(() => assertHttpUrl('http://[IP]:[PORT:1223]/'));
|
|
});
|