Skip to content

Commit b1168d9

Browse files
committed
chore: remove unneeded case
1 parent 768de7e commit b1168d9

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/ditamap/command.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,17 @@ export class Command extends Ditamap {
6868

6969
const commandName = command.id.replace(/:/g, asString(commandMeta.topicSeparator, ':'));
7070

71-
const examples = ((command.examples as string[]) || []).map((example) => {
72-
const parts = example.split('\n');
73-
const desc = parts.length > 1 ? parts[0] : null;
74-
const commands = parts.length > 1 ? parts.slice(1) : [parts[0]];
71+
const examples = (command.examples ?? []).map((example) => {
72+
let desc: string | null = null;
73+
let commands: string[] = [];
74+
if (typeof example === 'string') {
75+
const parts = example.split('\n');
76+
desc = parts.length > 1 ? parts[0] : null;
77+
commands = parts.length > 1 ? parts.slice(1) : [parts[0]];
78+
} else {
79+
desc = example.description;
80+
commands = [example.command];
81+
}
7582

7683
return {
7784
description: desc,

test/unit/endtoend.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function loadTestDitamapFile(path: string) {
2525
return readFileSync(join(testFilesPath, path), 'utf8');
2626
}
2727

28-
describe('plugin-login', () => {
28+
describe('plugin-auth', () => {
2929
const resolvedPath = resolve(process.cwd(), testFilesPath);
3030
before(async () => {
3131
try {

0 commit comments

Comments
 (0)