Skip to content

Commit 7536567

Browse files
@W-20893693: Adding AM topic with users, role and org subtopics
1 parent 8826487 commit 7536567

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

packages/b2c-cli/test/commands/docs/search.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@ import {ux} from '@oclif/core';
88
import {expect} from 'chai';
99
import {afterEach, beforeEach} from 'mocha';
1010
import sinon from 'sinon';
11+
import type {DocEntry, SearchResult} from '@salesforce/b2c-tooling-sdk/operations/docs';
1112
import DocsSearch from '../../../src/commands/docs/search.js';
1213
import {createIsolatedConfigHooks, createTestCommand, runSilent} from '../../helpers/test-setup.js';
1314

15+
interface ListDocsResponse {
16+
entries: DocEntry[];
17+
}
18+
19+
interface SearchDocsResponse {
20+
query?: string;
21+
results: SearchResult[];
22+
}
23+
1424
describe('docs search', () => {
1525
const hooks = createIsolatedConfigHooks();
1626

@@ -43,7 +53,7 @@ describe('docs search', () => {
4353
const listStub = sinon.stub().returns([{id: 'a', title: 'A', filePath: 'a.md'}]);
4454
command.operations = {...command.operations, listDocs: listStub};
4555

46-
const result = (await runSilent(() => command.run())) as {entries: unknown[]};
56+
const result = await runSilent<ListDocsResponse>(() => command.run());
4757

4858
expect(result.entries).to.have.length(1);
4959
});
@@ -69,7 +79,7 @@ describe('docs search', () => {
6979
const searchStub = sinon.stub().returns([{entry: {id: 'a', title: 'A', filePath: 'a.md'}, score: 0.1}]);
7080
command.operations = {...command.operations, searchDocs: searchStub};
7181

72-
const result = (await runSilent(() => command.run())) as {results: unknown[]};
82+
const result = await runSilent<SearchDocsResponse>(() => command.run());
7383

7484
expect(result.results).to.have.length(1);
7585
});

packages/b2c-cli/test/commands/ecdn/security/get.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@
66
import {expect} from 'chai';
77
import {afterEach, beforeEach} from 'mocha';
88
import sinon from 'sinon';
9+
import type {CdnZonesComponents} from '@salesforce/b2c-tooling-sdk/clients';
910
import EcdnSecurityGet from '../../../../src/commands/ecdn/security/get.js';
1011
import {createIsolatedConfigHooks, createTestCommand, runSilent} from '../../../helpers/test-setup.js';
1112

13+
type SecuritySetting = CdnZonesComponents['schemas']['SecuritySetting'];
14+
15+
interface GetOutput {
16+
settings: SecuritySetting;
17+
}
18+
1219
/**
1320
* Unit tests for eCDN security get command CLI logic.
1421
* Tests output formatting and error handling.
@@ -98,7 +105,7 @@ describe('ecdn security get', () => {
98105
}),
99106
});
100107

101-
const result = (await runSilent(() => command.run())) as {settings: {securityLevel: string; wafEnabled: boolean}};
108+
const result = await runSilent<GetOutput>(() => command.run());
102109

103110
expect(result.settings.securityLevel).to.equal('high');
104111
expect(result.settings.wafEnabled).to.be.true;

packages/b2c-cli/test/commands/ecdn/zones/list.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@
66
import {expect} from 'chai';
77
import {afterEach, beforeEach} from 'mocha';
88
import sinon from 'sinon';
9+
import type {Zone} from '@salesforce/b2c-tooling-sdk/clients';
910
import EcdnZonesList from '../../../../src/commands/ecdn/zones/list.js';
1011
import {createIsolatedConfigHooks, createTestCommand, runSilent} from '../../../helpers/test-setup.js';
1112

13+
interface ListOutput {
14+
zones: Zone[];
15+
total: number;
16+
}
17+
1218
/**
1319
* Unit tests for eCDN zones list command CLI logic.
1420
* Tests output formatting, column selection, and error handling.
@@ -129,7 +135,7 @@ describe('ecdn zones list', () => {
129135
}),
130136
});
131137

132-
const result = (await runSilent(() => command.run())) as {total: number; zones: Array<{name: string}>};
138+
const result = await runSilent<ListOutput>(() => command.run());
133139

134140
expect(result).to.have.property('total', 1);
135141
expect(result.zones).to.have.lengthOf(1);

0 commit comments

Comments
 (0)