mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
* feat(dev): add desktop tools-dev control plane * refactor(sidecar): split Open Design contracts Move Open Design-specific sidecar protocol definitions into @open-design/contracts so sidecar and platform can remain descriptor-driven primitives. * refactor(daemon): organize package sources Keep daemon app code, tests, and sidecar entrypoints in separate package directories so each layer can be built and verified independently. * chore(repo): streamline maintenance entrypoints Centralize agent guidance by directory and reduce root command chains while preserving the existing build scope. * docs: translate agent guidance to English * fix(sidecar): tolerate stale IPC sockets Remove stale Unix socket files only after confirming no listener is active, so tools-dev can restart after unclean shutdowns.
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import { validateArtifactManifestInput } from '../src/artifact-manifest.js';
|
|
|
|
function validBase() {
|
|
return {
|
|
kind: 'html',
|
|
renderer: 'html',
|
|
title: 'Test',
|
|
exports: ['html'],
|
|
};
|
|
}
|
|
|
|
describe('validateArtifactManifestInput', () => {
|
|
it('rejects empty exports', () => {
|
|
const res = validateArtifactManifestInput({ ...validBase(), exports: [] }, 'index.html');
|
|
expect(res.ok).toBe(false);
|
|
});
|
|
|
|
it('rejects invalid kind and renderer and export', () => {
|
|
expect(
|
|
validateArtifactManifestInput(
|
|
{ ...validBase(), kind: 'evil-kind', renderer: 'html', exports: ['html'] },
|
|
'index.html',
|
|
).ok,
|
|
).toBe(false);
|
|
expect(
|
|
validateArtifactManifestInput(
|
|
{ ...validBase(), kind: 'html', renderer: 'evil-renderer', exports: ['html'] },
|
|
'index.html',
|
|
).ok,
|
|
).toBe(false);
|
|
expect(
|
|
validateArtifactManifestInput(
|
|
{ ...validBase(), kind: 'html', renderer: 'html', exports: ['exe'] },
|
|
'index.html',
|
|
).ok,
|
|
).toBe(false);
|
|
});
|
|
|
|
it('rejects traversal in supportingFiles', () => {
|
|
const res = validateArtifactManifestInput(
|
|
{ ...validBase(), supportingFiles: ['../secret.txt'] },
|
|
'index.html',
|
|
);
|
|
expect(res.ok).toBe(false);
|
|
});
|
|
});
|