From 2ca8c4801f817feb9fa4e8b5effc4a57f88d37c9 Mon Sep 17 00:00:00 2001 From: Nanddeep Nachan Date: Thu, 20 Jul 2023 10:56:34 +0000 Subject: [PATCH 1/7] spo listitem attachment get --- .../spo/listitem/listitem-attachment-get.mdx | 104 +++++++++ docs/src/config/sidebars.js | 5 + src/m365/spo/commands.ts | 1 + .../listitem/listitem-attachment-get.spec.ts | 209 ++++++++++++++++++ .../listitem/listitem-attachment-get.ts | 132 +++++++++++ 5 files changed, 451 insertions(+) create mode 100644 docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx create mode 100644 src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts create mode 100644 src/m365/spo/commands/listitem/listitem-attachment-get.ts diff --git a/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx b/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx new file mode 100644 index 00000000000..5e40d700df2 --- /dev/null +++ b/docs/docs/cmd/spo/listitem/listitem-attachment-get.mdx @@ -0,0 +1,104 @@ +import Global from '/docs/cmd/_global.mdx'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# spo listitem attachment get + +Gets an attachment from a list item + +## Usage + +```sh +m365 spo listitem attachment get [options] +``` + +## Options + +```md definition-list +`-u, --webUrl ` +: URL of the site where the list item is located. + +`--listId [listId]` +: ID of the list. Specify either `listTitle`, `listId` or `listUrl`. + +`--listTitle [listTitle]` +: Title of the list. Specify either `listTitle`, `listId` or `listUrl`. + +`--listUrl [listUrl]` +: Server- or site-relative URL of the list. Specify either `listTitle`, `listId` or `listUrl`. + +`--listItemId ` +: The ID of the list item. + +`-n, --fileName ` +: Name of the file to get. +``` + + + +## Examples + +Get an attachment from a list item by using list title. + +```sh +m365 spo listitem attachment get --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle "Demo List" --listItemId 147 --fileName "File1.jpg" +``` + +Get an attachment from a list item by using list URL. + +```sh +m365 spo listitem attachment get --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl "/sites/project-x/Lists/DemoList" --listItemId 147 --fileName "File1.jpg" +``` + +## Response + + + + + ```json + { + "FileName": "File1.jpg", + "FileNameAsPath": { + "DecodedUrl": "File1.jpg" + }, + "ServerRelativePath": { + "DecodedUrl": "/sites/project-x/Lists/DemoListAttachments/147/File1.jpg" + }, + "ServerRelativeUrl": "/sites/project-x/Lists/DemoListAttachments/147/File1.jpg" + } + ``` + + + + + ```text + FileName : File1.jpg + FileNameAsPath : {"DecodedUrl":"File1.jpg"} + ServerRelativePath: {"DecodedUrl":"/sites/project-x/Lists/DemoListAttachments/147/File1.jpg"} + ServerRelativeUrl : /sites/project-x/Lists/DemoListAttachments/147/File1.jpg + ``` + + + + + ```csv + FileName,ServerRelativeUrl + File1.jpg,/sites/project-x/Lists/DemoListAttachments/147/File1.jpg + ``` + + + + + ```md + # spo listitem attachment get --webUrl "https://contoso.sharepoint.com/sites/project-x" --listTitle "PnP PowerShell List" --listItemId "1" --fileName "File1.jpg" + + Date: 7/20/2023 + + Property | Value + ---------|------- + FileName | File1.jpg + ServerRelativeUrl | /sites/project-x/Lists/DemoListAttachments/147/File1.jpg + ``` + + + diff --git a/docs/src/config/sidebars.js b/docs/src/config/sidebars.js index 83ce9e2b3d3..54e1a9a36e9 100644 --- a/docs/src/config/sidebars.js +++ b/docs/src/config/sidebars.js @@ -2621,6 +2621,11 @@ const sidebars = { label: 'listitem remove', id: 'cmd/spo/listitem/listitem-remove' }, + { + type: 'doc', + label: 'listitem attachment get', + id: 'cmd/spo/listitem/listitem-attachment-get' + }, { type: 'doc', label: 'listitem attachment list', diff --git a/src/m365/spo/commands.ts b/src/m365/spo/commands.ts index aa2ad3e06cc..29363776144 100644 --- a/src/m365/spo/commands.ts +++ b/src/m365/spo/commands.ts @@ -159,6 +159,7 @@ export default { LIST_WEBHOOK_REMOVE: `${prefix} list webhook remove`, LIST_WEBHOOK_SET: `${prefix} list webhook set`, LISTITEM_ADD: `${prefix} listitem add`, + LISTITEM_ATTACHMENT_GET: `${prefix} listitem attachment get`, LISTITEM_ATTACHMENT_LIST: `${prefix} listitem attachment list`, LISTITEM_BATCH_ADD: `${prefix} listitem batch add`, LISTITEM_BATCH_SET: `${prefix} listitem batch set`, diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts new file mode 100644 index 00000000000..fde767d8115 --- /dev/null +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts @@ -0,0 +1,209 @@ +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { telemetry } from '../../../../telemetry'; +import auth from '../../../../Auth'; +import { Cli } from '../../../../cli/Cli'; +import { CommandInfo } from '../../../../cli/CommandInfo'; +import { Logger } from '../../../../cli/Logger'; +import Command, { CommandError } from '../../../../Command'; +import request from '../../../../request'; +import { formatting } from '../../../../utils/formatting'; +import { pid } from '../../../../utils/pid'; +import { session } from '../../../../utils/session'; +import { sinonUtil } from '../../../../utils/sinonUtil'; +import { urlUtil } from '../../../../utils/urlUtil'; +import commands from '../../commands'; +const command: Command = require('./listitem-attachment-get'); + +describe(commands.LISTITEM_ATTACHMENT_LIST, () => { + const webUrl = 'https://contoso.sharepoint.com/sites/project-x'; + const listId = '4fc5ba1e-18b7-49e0-81fe-54515cc2eede'; + const listTitle = 'Demo List'; + const listUrl = '/sites/project-x/Lists/DemoList'; + const listItemId = 147; + const fileName = 'File1.jpg'; + const listServerRelativeUrl: string = urlUtil.getServerRelativePath(webUrl, listUrl); + + let cli: Cli; + let log: any[]; + let logger: Logger; + let loggerLogSpy: sinon.SinonSpy; + let commandInfo: CommandInfo; + + const attachmentResponse = { + "FileName": "File1.jpg", + "FileNameAsPath": { + "DecodedUrl": "File1.jpg" + }, + "ServerRelativePath": { + "DecodedUrl": "/sites/project-x/Lists/DemoListAttachments/147/File1.jpg" + }, + "ServerRelativeUrl": "/sites/project-x/Lists/DemoListAttachments/147/File1.jpg" + }; + + const getFakes = async (opts: any) => { + if ((opts.url as string).indexOf('/_api/web/lists') > -1) { + return attachmentResponse; + } + + if (opts.url === `https://contoso.sharepoint.com/sites/project-x/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')/items(147)/AttachmentFiles('${fileName}')`) { + return attachmentResponse; + } + + throw 'Invalid request'; + }; + + before(() => { + cli = Cli.getInstance(); + sinon.stub(auth, 'restoreAuth').callsFake(() => Promise.resolve()); + sinon.stub(telemetry, 'trackEvent').callsFake(() => { }); + sinon.stub(pid, 'getProcessName').callsFake(() => ''); + sinon.stub(session, 'getId').callsFake(() => ''); + auth.service.connected = true; + commandInfo = Cli.getCommandInfo(command); + }); + + beforeEach(() => { + log = []; + logger = { + log: (msg: string) => { + log.push(msg); + }, + logRaw: (msg: string) => { + log.push(msg); + }, + logToStderr: (msg: string) => { + log.push(msg); + } + }; + loggerLogSpy = sinon.spy(logger, 'log'); + sinon.stub(cli, 'getSettingWithDefaultValue').callsFake(((settingName, defaultValue) => defaultValue)); + }); + + afterEach(() => { + sinonUtil.restore([ + request.get, + cli.getSettingWithDefaultValue + ]); + }); + + after(() => { + sinon.restore(); + auth.service.connected = false; + }); + + it('has correct name', () => { + assert.strictEqual(command.name, commands.LISTITEM_ATTACHMENT_GET); + }); + + it('has a description', () => { + assert.notStrictEqual(command.description, null); + }); + + it('supports specifying URL', () => { + const options = command.options; + let containsTypeOption = false; + options.forEach(o => { + if (o.option.indexOf('') > -1) { + containsTypeOption = true; + } + }); + assert(containsTypeOption); + }); + + it('fails validation if the webUrl option is not a valid SharePoint site URL', async () => { + const actual = await command.validate({ options: { webUrl: 'foo', listTitle: 'Demo List', listItemId: listItemId, fileName: fileName } }, commandInfo); + assert.notStrictEqual(actual, true); + }); + + it('passes validation if the webUrl option is a valid SharePoint site URL', async () => { + const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', listTitle: 'Demo List', listItemId: listItemId, fileName: fileName } }, commandInfo); + assert(actual); + }); + + it('fails validation if the listId option is not a valid GUID', async () => { + const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', listId: 'foo', listItemId: listItemId, fileName: fileName } }, commandInfo); + assert.notStrictEqual(actual, true); + }); + + it('passes validation if the listId option is a valid GUID', async () => { + const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', listId: listId, listItemId: listItemId, fileName: fileName } }, commandInfo); + assert(actual); + }); + + it('fails validation if the specified listItemId is not a number', async () => { + const actual = await command.validate({ options: { webUrl: 'https://contoso.sharepoint.com', listTitle: 'Demo List', listItemId: 'a', fileName: fileName } }, commandInfo); + assert.notStrictEqual(actual, true); + }); + + it('returns attachment from a list item by listId', async () => { + sinon.stub(request, 'get').callsFake(getFakes); + + const options: any = { + debug: true, + webUrl: webUrl, + listId: listId, + listItemId: listItemId, + fileName: fileName + }; + + await command.action(logger, { options: options } as any); + assert(loggerLogSpy.calledWith(attachmentResponse)); + }); + + it('returns attachment from a list item by listTitle', async () => { + sinon.stub(request, 'get').callsFake(getFakes); + + const options: any = { + debug: true, + webUrl: webUrl, + listTitle: listTitle, + listItemId: listItemId, + fileName: fileName + }; + + await command.action(logger, { options: options } as any); + assert(loggerLogSpy.calledWith(attachmentResponse)); + }); + + it('returns attachment from a list item by listUrl', async () => { + sinon.stub(request, 'get').callsFake(getFakes); + + const options: any = { + debug: true, + webUrl: webUrl, + listUrl: listUrl, + listItemId: listItemId, + fileName: fileName + }; + + await command.action(logger, { options: options } as any); + assert(loggerLogSpy.calledWith(attachmentResponse)); + }); + + it('correctly handles random API error', async () => { + sinon.stub(request, 'get').callsFake(() => Promise.reject('An error has occurred')); + + const options: any = { + webUrl: webUrl, + listId: listId, + listItemId: listItemId, + fileName: fileName + }; + + await assert.rejects(command.action(logger, { options: options } as any), new CommandError('An error has occurred')); + }); + + it('correctly handles no attachment found', async () => { + sinon.stub(request, 'get').rejects(new Error('Specified argument was out of the range of valid values.\r\nParameter name: fileName')); + + await assert.rejects(command.action(logger, { + options: { + webUrl: webUrl, + listId: listId, + listItemId: listItemId, + fileName: fileName + } + } as any), new CommandError('Specified argument was out of the range of valid values.\r\nParameter name: fileName')); + }); +}); \ No newline at end of file diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.ts new file mode 100644 index 00000000000..1b3b519c66e --- /dev/null +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.ts @@ -0,0 +1,132 @@ +import { Logger } from '../../../../cli/Logger'; +import GlobalOptions from '../../../../GlobalOptions'; +import request, { CliRequestOptions } from '../../../../request'; +import { formatting } from '../../../../utils/formatting'; +import { urlUtil } from '../../../../utils/urlUtil'; +import { validation } from '../../../../utils/validation'; +import SpoCommand from '../../../base/SpoCommand'; +import commands from '../../commands'; + +interface CommandArgs { + options: Options; +} + +interface Options extends GlobalOptions { + webUrl: string; + listId?: string; + listTitle?: string; + listUrl?: string; + listItemId: string; + fileName: string; +} + +class SpoListItemAttachmentGetCommand extends SpoCommand { + public get name(): string { + return commands.LISTITEM_ATTACHMENT_GET; + } + + public get description(): string { + return 'Gets an attachment from a list item'; + } + + constructor() { + super(); + + this.#initTelemetry(); + this.#initOptions(); + this.#initValidators(); + this.#initOptionSets(); + } + + #initTelemetry(): void { + this.telemetry.push((args: CommandArgs) => { + Object.assign(this.telemetryProperties, { + listId: typeof args.options.listId !== 'undefined', + listTitle: typeof args.options.listTitle !== 'undefined', + listUrl: typeof args.options.listUrl !== 'undefined' + }); + }); + } + + #initOptions(): void { + this.options.unshift( + { + option: '-u, --webUrl ' + }, + { + option: '--listId [listId]' + }, + { + option: '--listTitle [listTitle]' + }, + { + option: '--listUrl [listUrl]' + }, + { + option: '--listItemId ' + }, + { + option: '-n, --fileName ' + } + ); + } + + #initValidators(): void { + this.validators.push( + async (args: CommandArgs) => { + const isValidSharePointUrl: boolean | string = validation.isValidSharePointUrl(args.options.webUrl); + if (isValidSharePointUrl !== true) { + return isValidSharePointUrl; + } + + if (args.options.listId && !validation.isValidGuid(args.options.listId)) { + return `${args.options.listId} in option listId is not a valid GUID`; + } + + if (isNaN(parseInt(args.options.listItemId))) { + return `${args.options.listItemId} is not a number`; + } + + return true; + } + ); + } + + #initOptionSets(): void { + this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] }); + } + + public async commandAction(logger: Logger, args: CommandArgs): Promise { + let requestUrl = `${args.options.webUrl}/_api/web`; + + if (args.options.listId) { + requestUrl += `/lists(guid'${formatting.encodeQueryParameter(args.options.listId)}')`; + } + else if (args.options.listTitle) { + requestUrl += `/lists/getByTitle('${formatting.encodeQueryParameter(args.options.listTitle)}')`; + } + else if (args.options.listUrl) { + const listServerRelativeUrl: string = urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl); + requestUrl += `/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')`; + } + + const requestOptions: CliRequestOptions = { + url: `${requestUrl}/items(${args.options.listItemId})/AttachmentFiles('${args.options.fileName}')`, + method: 'GET', + headers: { + 'accept': 'application/json;odata=nometadata' + }, + responseType: 'json' + }; + + try { + const attachmentFile = await request.get(requestOptions); + logger.log(attachmentFile); + } + catch (err: any) { + this.handleRejectedODataJsonPromise(err); + } + } +} + +module.exports = new SpoListItemAttachmentGetCommand(); \ No newline at end of file From 074a99d7212d157019cc0229ba948544e01f1816 Mon Sep 17 00:00:00 2001 From: Nanddeep Nachan Date: Mon, 4 Sep 2023 12:51:31 +0000 Subject: [PATCH 2/7] review comments --- .../listitem/listitem-attachment-get.spec.ts | 32 +++++++++---------- .../listitem/listitem-attachment-get.ts | 4 +-- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts index fde767d8115..345c7d57846 100644 --- a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts @@ -1,18 +1,18 @@ import * as assert from 'assert'; import * as sinon from 'sinon'; -import { telemetry } from '../../../../telemetry'; -import auth from '../../../../Auth'; -import { Cli } from '../../../../cli/Cli'; -import { CommandInfo } from '../../../../cli/CommandInfo'; -import { Logger } from '../../../../cli/Logger'; -import Command, { CommandError } from '../../../../Command'; -import request from '../../../../request'; -import { formatting } from '../../../../utils/formatting'; -import { pid } from '../../../../utils/pid'; -import { session } from '../../../../utils/session'; -import { sinonUtil } from '../../../../utils/sinonUtil'; -import { urlUtil } from '../../../../utils/urlUtil'; -import commands from '../../commands'; +import { telemetry } from '../../../../telemetry.js'; +import auth from '../../../../Auth.js'; +import { Cli } from '../../../../cli/Cli.js'; +import { CommandInfo } from '../../../../cli/CommandInfo.js'; +import { Logger } from '../../../../cli/Logger.js'; +import Command, { CommandError } from '../../../../Command.js'; +import request from '../../../../request.js'; +import { formatting } from '../../../../utils/formatting.js'; +import { pid } from '../../../../utils/pid.js'; +import { session } from '../../../../utils/session.js'; +import { sinonUtil } from '../../../../utils/sinonUtil.js'; +import { urlUtil } from '../../../../utils/urlUtil.js'; +import commands from '../../commands.js'; const command: Command = require('./listitem-attachment-get'); describe(commands.LISTITEM_ATTACHMENT_LIST, () => { @@ -66,13 +66,13 @@ describe(commands.LISTITEM_ATTACHMENT_LIST, () => { beforeEach(() => { log = []; logger = { - log: (msg: string) => { + log: async (msg: string) => { log.push(msg); }, - logRaw: (msg: string) => { + logRaw: async (msg: string) => { log.push(msg); }, - logToStderr: (msg: string) => { + logToStderr: async (msg: string) => { log.push(msg); } }; diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.ts index 1b3b519c66e..b121846c326 100644 --- a/src/m365/spo/commands/listitem/listitem-attachment-get.ts +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.ts @@ -121,7 +121,7 @@ class SpoListItemAttachmentGetCommand extends SpoCommand { try { const attachmentFile = await request.get(requestOptions); - logger.log(attachmentFile); + await logger.log(attachmentFile); } catch (err: any) { this.handleRejectedODataJsonPromise(err); @@ -129,4 +129,4 @@ class SpoListItemAttachmentGetCommand extends SpoCommand { } } -module.exports = new SpoListItemAttachmentGetCommand(); \ No newline at end of file +export default new SpoListItemAttachmentGetCommand(); \ No newline at end of file From d6468fe8dad49fa40c94dc570ff70e271ac5803b Mon Sep 17 00:00:00 2001 From: Nanddeep Nachan Date: Mon, 4 Sep 2023 13:02:40 +0000 Subject: [PATCH 3/7] use import --- src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts index 345c7d57846..639b70f0a28 100644 --- a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts @@ -13,7 +13,7 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import { urlUtil } from '../../../../utils/urlUtil.js'; import commands from '../../commands.js'; -const command: Command = require('./listitem-attachment-get'); +const command: Command = import('./listitem-attachment-get.js'); describe(commands.LISTITEM_ATTACHMENT_LIST, () => { const webUrl = 'https://contoso.sharepoint.com/sites/project-x'; From 10030a625c94d2e7ae0201f3964a748676c4b1c7 Mon Sep 17 00:00:00 2001 From: Nanddeep Nachan Date: Mon, 4 Sep 2023 13:06:02 +0000 Subject: [PATCH 4/7] import --- src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts index 639b70f0a28..de11faa7937 100644 --- a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts @@ -13,7 +13,7 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import { urlUtil } from '../../../../utils/urlUtil.js'; import commands from '../../commands.js'; -const command: Command = import('./listitem-attachment-get.js'); +const command: Command = import('./listitem-attachment-get'); describe(commands.LISTITEM_ATTACHMENT_LIST, () => { const webUrl = 'https://contoso.sharepoint.com/sites/project-x'; From e6336d581a0550725842858611d5a66e7e6eea1a Mon Sep 17 00:00:00 2001 From: Nanddeep Nachan Date: Mon, 4 Sep 2023 13:19:14 +0000 Subject: [PATCH 5/7] import command --- .../spo/commands/listitem/listitem-attachment-get.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts index de11faa7937..8c4ec0c99dd 100644 --- a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts @@ -5,7 +5,7 @@ import auth from '../../../../Auth.js'; import { Cli } from '../../../../cli/Cli.js'; import { CommandInfo } from '../../../../cli/CommandInfo.js'; import { Logger } from '../../../../cli/Logger.js'; -import Command, { CommandError } from '../../../../Command.js'; +import { CommandError } from '../../../../Command.js'; import request from '../../../../request.js'; import { formatting } from '../../../../utils/formatting.js'; import { pid } from '../../../../utils/pid.js'; @@ -13,7 +13,7 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import { urlUtil } from '../../../../utils/urlUtil.js'; import commands from '../../commands.js'; -const command: Command = import('./listitem-attachment-get'); +import command from './listitem-attachment-get.js'; describe(commands.LISTITEM_ATTACHMENT_LIST, () => { const webUrl = 'https://contoso.sharepoint.com/sites/project-x'; From 6229cf99db6c06905270551e2530c0039e575c4a Mon Sep 17 00:00:00 2001 From: Nanddeep Nachan Date: Mon, 4 Sep 2023 13:43:16 +0000 Subject: [PATCH 6/7] command name --- src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts index 8c4ec0c99dd..f841096a9d3 100644 --- a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts @@ -15,7 +15,7 @@ import { urlUtil } from '../../../../utils/urlUtil.js'; import commands from '../../commands.js'; import command from './listitem-attachment-get.js'; -describe(commands.LISTITEM_ATTACHMENT_LIST, () => { +describe(commands.LISTITEM_ATTACHMENT_GET, () => { const webUrl = 'https://contoso.sharepoint.com/sites/project-x'; const listId = '4fc5ba1e-18b7-49e0-81fe-54515cc2eede'; const listTitle = 'Demo List'; From 380bf112c3802a044e378c559bc1dc39df367a15 Mon Sep 17 00:00:00 2001 From: Nanddeep Nachan Date: Mon, 4 Sep 2023 14:16:13 +0000 Subject: [PATCH 7/7] import statements --- .../listitem/listitem-attachment-get.spec.ts | 4 ++-- .../commands/listitem/listitem-attachment-get.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts index f841096a9d3..7871d74b085 100644 --- a/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.spec.ts @@ -1,5 +1,5 @@ -import * as assert from 'assert'; -import * as sinon from 'sinon'; +import assert from 'assert'; +import sinon from 'sinon'; import { telemetry } from '../../../../telemetry.js'; import auth from '../../../../Auth.js'; import { Cli } from '../../../../cli/Cli.js'; diff --git a/src/m365/spo/commands/listitem/listitem-attachment-get.ts b/src/m365/spo/commands/listitem/listitem-attachment-get.ts index b121846c326..6dbebec7080 100644 --- a/src/m365/spo/commands/listitem/listitem-attachment-get.ts +++ b/src/m365/spo/commands/listitem/listitem-attachment-get.ts @@ -1,11 +1,11 @@ -import { Logger } from '../../../../cli/Logger'; -import GlobalOptions from '../../../../GlobalOptions'; -import request, { CliRequestOptions } from '../../../../request'; -import { formatting } from '../../../../utils/formatting'; -import { urlUtil } from '../../../../utils/urlUtil'; -import { validation } from '../../../../utils/validation'; -import SpoCommand from '../../../base/SpoCommand'; -import commands from '../../commands'; +import { Logger } from '../../../../cli/Logger.js'; +import GlobalOptions from '../../../../GlobalOptions.js'; +import request, { CliRequestOptions } from '../../../../request.js'; +import { formatting } from '../../../../utils/formatting.js'; +import { urlUtil } from '../../../../utils/urlUtil.js'; +import { validation } from '../../../../utils/validation.js'; +import SpoCommand from '../../../base/SpoCommand.js'; +import commands from '../../commands.js'; interface CommandArgs { options: Options;