Files
open-design/apps/daemon/tests/artifact-manifest.test.ts
PerishFireandGitHub c6d11018a0 Refresh desktop integration control plane (#123)
* 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.
2026-04-30 14:23:53 +08:00

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);
});
});