build(docs-infra): ensure that CLI options are included in search (#35801)
PR Close #35801
This commit is contained in:

committed by
atscott

parent
c1b5daf5a8
commit
603ab40e85
@ -95,6 +95,22 @@ describe('processCliCommands processor', () => {
|
||||
jasmine.objectContaining({name: 'c'}),
|
||||
]);
|
||||
});
|
||||
|
||||
it('should collect potential search terms from options for indexing', () => {
|
||||
const doc = {
|
||||
docType: 'cli-command',
|
||||
name: 'name',
|
||||
commandAliases: [],
|
||||
options: [
|
||||
{name: 'named1'},
|
||||
{name: 'positional1', positional: 0},
|
||||
{name: 'named2', hidden: true},
|
||||
{name: 'positional2', hidden: true, positional: 1},
|
||||
],
|
||||
};
|
||||
processor.$process([doc, navigationStub]);
|
||||
expect(doc.optionKeywords).toEqual('named1 positional1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('subcommands', () => {
|
||||
@ -285,4 +301,36 @@ describe('processCliCommands processor', () => {
|
||||
'Missing `cli` url - CLI Commands must include a first child node with url set at `cli`',
|
||||
navigation));
|
||||
});
|
||||
|
||||
it('should collect potential search terms from options for indexing', () => {
|
||||
const doc = {
|
||||
docType: 'cli-command',
|
||||
name: 'name',
|
||||
commandAliases: [],
|
||||
options: [{
|
||||
name: 'supercommand',
|
||||
subcommands: {
|
||||
subcommand1: {
|
||||
name: 'subcommand1',
|
||||
options: [
|
||||
{name: 'subcommand1-option1'},
|
||||
{name: 'subcommand1-option2'},
|
||||
],
|
||||
},
|
||||
subcommand2: {
|
||||
name: 'subcommand2',
|
||||
options: [
|
||||
{name: 'subcommand2-option1'},
|
||||
{name: 'subcommand2-option2'},
|
||||
],
|
||||
}
|
||||
},
|
||||
}],
|
||||
};
|
||||
processor.$process([doc, navigationStub]);
|
||||
expect(doc.optionKeywords)
|
||||
.toEqual(
|
||||
'supercommand subcommand1 subcommand1-option1 subcommand1-option2 subcommand2 subcommand2-option1 subcommand2-option2');
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user