Files

37 lines
2.1 KiB
JavaScript

import assert from 'node:assert/strict';
import test from 'node:test';
import { catalogPages, catalogs } from '../src/lib/catalog.ts';
const rustRepository = 'https://gitea.hareworks.net/Hare/wip-rs';
test('Sources lists only the confirmed documentation and Rust repositories', () => {
assert.deepEqual(catalogs.sources.entries.map((entry) => [entry.name, entry.links]), [
['wip-reference', [{ label: 'Source', href: 'https://gitea.hareworks.net/Hare/wip-reference' }]],
['wip-rs', [{ label: 'Source', href: rustRepository }]],
]);
assert.deepEqual(catalogPages.map((page) => [page.path, page.title]), [['/sources', 'Sources'], ['/packages', 'Packages']]);
});
test('Packages retains the seven publishable Rust crates in README order with manifest descriptions', () => {
assert.deepEqual(catalogs.packages.entries.map((entry) => [entry.name, entry.description]), [
['wip-protocol', 'Transport-independent logical model and validation for WIP'],
['wip-interface-macros', 'Procedural macros for WIP interface declarations and DTO codecs'],
['wip-interface', 'Public Rust authoring API for WIP interfaces and operation value codecs'],
['wip-host', 'Host-side object publication and operation dispatch for WIP'],
['wip-http', 'Framework-independent standard WIP over HTTP v1 binding'],
['wip-client', 'Presentation-independent stateful WIP client runtime'],
['wip-text-view', 'Standalone Object and Interface Text View signatures for WIP'],
]);
for (const entry of catalogs.packages.entries) {
assert.deepEqual(entry.links, [
{ label: 'Source', href: `${rustRepository}/src/branch/master/crates/${entry.name}` },
{ label: 'Workspace README', href: `${rustRepository}/src/branch/master/README.md` },
]);
assert.equal('version' in entry, false);
assert.ok(!['wip-fs-server', 'wip-tui', 'wip-public-api-example', 'wip-site-worldspace', 'wip-browser'].includes(entry.name));
}
assert.match(catalogs.packages.description, /公開状況・公開バージョンを示すものではありません/);
assert.ok(!JSON.stringify(catalogs).includes('crates.io'));
assert.ok(!JSON.stringify(catalogs).includes('docs.rs'));
});