mirror of
https://github.com/jackwener/OpenCLI.git
synced 2026-09-14 18:25:42 +08:00
0204dbb018
* feat(notebooklm): add read commands and compatibility layer * review: trim notebooklm artifacts and sync docs --------- Co-authored-by: qiaoqiao147 <camtup044@gmail.com> Co-authored-by: jackwener <jakevingoo@gmail.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import type { CliCommand } from './registry.js';
|
|
import { Strategy } from './registry.js';
|
|
import { formatRegistryHelpText, serializeCommand } from './serialization.js';
|
|
|
|
describe('formatRegistryHelpText', () => {
|
|
it('summarizes long choices lists so help text stays readable', () => {
|
|
const cmd: CliCommand = {
|
|
site: 'demo',
|
|
name: 'dynamic',
|
|
description: 'Demo command',
|
|
strategy: Strategy.PUBLIC,
|
|
browser: false,
|
|
args: [
|
|
{
|
|
name: 'field',
|
|
help: 'Field to use',
|
|
choices: ['all-fields', 'topic', 'title', 'author', 'publication-titles', 'year-published', 'doi'],
|
|
},
|
|
],
|
|
columns: ['field'],
|
|
};
|
|
|
|
expect(formatRegistryHelpText(cmd)).toContain('--field: all-fields, topic, title, author, ... (+3 more)');
|
|
});
|
|
|
|
it('includes aliases in structured serialization and help text', () => {
|
|
const cmd: CliCommand = {
|
|
site: 'demo',
|
|
name: 'get',
|
|
aliases: ['metadata'],
|
|
description: 'Demo command',
|
|
strategy: Strategy.COOKIE,
|
|
browser: true,
|
|
args: [],
|
|
};
|
|
|
|
expect(serializeCommand(cmd)).toMatchObject({
|
|
command: 'demo/get',
|
|
aliases: ['metadata'],
|
|
});
|
|
expect(formatRegistryHelpText(cmd)).toContain('Aliases: metadata');
|
|
});
|
|
});
|