Skip to content

Commit

Permalink
updates based on Adam feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
reshmee011 committed Oct 17, 2024
1 parent e3ce715 commit bc098dd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
8 changes: 4 additions & 4 deletions docs/src/config/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1969,13 +1969,13 @@ const sidebars: SidebarsConfig = {
},
{
type: 'doc',
label: 'containertype list',
id: 'cmd/spe/containertype/containertype-list'
label: 'containertype get',
id: 'cmd/spe/containertype/containertype-get'
},
{
type: 'doc',
label: 'containertype get',
id: 'cmd/spe/containertype/containertype-get'
label: 'containertype list',
id: 'cmd/spe/containertype/containertype-list'
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions src/m365/spe/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ const prefix: string = 'spe';

export default {
CONTAINERTYPE_ADD: `${prefix} containertype add`,
CONTAINERTYPE_GET: `${prefix} containertype get`
CONTAINERTYPE_LIST: `${prefix} containertype list`,
CONTAINERTYPE_GET: `${prefix} containertype get`,
CONTAINERTYPE_LIST: `${prefix} containertype list`
};
4 changes: 0 additions & 4 deletions src/m365/spe/commands/containertype/containertype-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ describe(commands.CONTAINERTYPE_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['ContainerTypeId', 'DisplayName', 'OwningAppId']);
});

it('correctly handles random API error', async () => {
sinon.stub(request, 'post').rejects(new Error('An error has occurred'));

Expand Down
14 changes: 5 additions & 9 deletions src/m365/spe/commands/containertype/containertype-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,14 @@ class SpeContainertypeGetCommand extends SpoCommand {
this.types.string.push('id', 'name');
}

public defaultProperties(): string[] | undefined {
return ['ContainerTypeId', 'DisplayName', 'OwningAppId'];
}

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
try {
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);

if (this.verbose) {
await logger.logToStderr(`Getting the Container type...`);
}

const containerTypeId = await this.getContainerTypeId(args.options, spoAdminUrl, logger);
const allContainerTypes = await this.getContainerTypeById(containerTypeId, spoAdminUrl, logger);
await logger.log(allContainerTypes);
Expand Down Expand Up @@ -124,12 +120,12 @@ class SpeContainertypeGetCommand extends SpoCommand {
return containerTypes;
}

private async getContainerTypeId(args: CommandArgs, spoAdminUrl: string, logger: Logger): Promise<string> {
if (args.options.id) {
return args.options.id;
private async getContainerTypeId(options: Options, spoAdminUrl: string, logger: Logger): Promise<string> {
if (options.id) {
return options.id;
}

return this.getContainerTypeIdByName(args.options.name!, spoAdminUrl, logger);
return this.getContainerTypeIdByName(options.name!, spoAdminUrl, logger);
}

private async getContainerTypeIdByName(name: string, spoAdminUrl: string, logger: Logger): Promise<string> {
Expand Down

0 comments on commit bc098dd

Please sign in to comment.