From bc098dd847fc739532beb7f6ecfdef0ca7c980ef Mon Sep 17 00:00:00 2001 From: reshmee011 Date: Thu, 17 Oct 2024 13:59:22 +0000 Subject: [PATCH] updates based on Adam feedback --- docs/src/config/sidebars.ts | 8 ++++---- src/m365/spe/commands.ts | 4 ++-- .../containertype/containertype-get.spec.ts | 4 ---- .../commands/containertype/containertype-get.ts | 14 +++++--------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/docs/src/config/sidebars.ts b/docs/src/config/sidebars.ts index 3d24739feb..5aa77ee8c4 100644 --- a/docs/src/config/sidebars.ts +++ b/docs/src/config/sidebars.ts @@ -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' } ] } diff --git a/src/m365/spe/commands.ts b/src/m365/spe/commands.ts index ae5d713a6c..4013a0d0e1 100644 --- a/src/m365/spe/commands.ts +++ b/src/m365/spe/commands.ts @@ -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` }; \ No newline at end of file diff --git a/src/m365/spe/commands/containertype/containertype-get.spec.ts b/src/m365/spe/commands/containertype/containertype-get.spec.ts index 427a3c55b0..03d527d1a3 100644 --- a/src/m365/spe/commands/containertype/containertype-get.spec.ts +++ b/src/m365/spe/commands/containertype/containertype-get.spec.ts @@ -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')); diff --git a/src/m365/spe/commands/containertype/containertype-get.ts b/src/m365/spe/commands/containertype/containertype-get.ts index 7452a0ece8..bda14ea1d4 100644 --- a/src/m365/spe/commands/containertype/containertype-get.ts +++ b/src/m365/spe/commands/containertype/containertype-get.ts @@ -80,10 +80,6 @@ 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 { try { const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug); @@ -91,7 +87,7 @@ class SpeContainertypeGetCommand extends SpoCommand { 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); @@ -124,12 +120,12 @@ class SpeContainertypeGetCommand extends SpoCommand { return containerTypes; } - private async getContainerTypeId(args: CommandArgs, spoAdminUrl: string, logger: Logger): Promise { - if (args.options.id) { - return args.options.id; + private async getContainerTypeId(options: Options, spoAdminUrl: string, logger: Logger): Promise { + 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 {