Add interactive SSH portfolio features
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { validateConfig } from '../src/config.js';
|
||||
|
||||
const valid = () => ({
|
||||
theme: { primary: 'cyan', accent: 'yellow', muted: 'brightBlack' },
|
||||
host: { port: 2222, notificationPort: 7777, hostKeyPath: 'data/host.key' },
|
||||
adminPublicKeys: []
|
||||
});
|
||||
|
||||
test('accepts a valid configuration', () => assert.equal(validateConfig(valid()).host.port, 2222));
|
||||
test('rejects invalid ports with an actionable path', () => {
|
||||
const config = valid(); config.host.port = 70000;
|
||||
assert.throws(() => validateConfig(config), /host\.port/);
|
||||
});
|
||||
test('rejects unknown colors with an actionable path', () => {
|
||||
const config = valid(); config.theme.primary = 'orange';
|
||||
assert.throws(() => validateConfig(config), /theme\.primary/);
|
||||
});
|
||||
test('accepts key blobs and OpenSSH public-key lines', () => {
|
||||
const config = valid(); config.adminPublicKeys = ['QUJDRA==', 'ssh-ed25519 QUJDRA== owner'];
|
||||
assert.doesNotThrow(() => validateConfig(config));
|
||||
});
|
||||
Reference in New Issue
Block a user