From f3bd083669c091e4f892722a0d9aadcf372d3d60 Mon Sep 17 00:00:00 2001 From: Martin Machacek Date: Tue, 7 Jan 2025 10:04:31 +0100 Subject: [PATCH] New command: m365 graph directoryextension add --- .../directoryextension-add.spec.ts | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/m365/graph/commands/directoryextension/directoryextension-add.spec.ts b/src/m365/graph/commands/directoryextension/directoryextension-add.spec.ts index 574693cb8fd..58658926507 100644 --- a/src/m365/graph/commands/directoryextension/directoryextension-add.spec.ts +++ b/src/m365/graph/commands/directoryextension/directoryextension-add.spec.ts @@ -235,7 +235,15 @@ describe(commands.DIRECTORYEXTENSION_ADD, () => { throw 'Invalid request'; }); - await command.action(logger, { options: { appObjectId: appObjectId, name: 'GitHubWorkAccount', dataType: 'String', targetObjects: 'User', verbose: true } }); + + const parsedSchema = commandOptionsSchema.safeParse({ + appObjectId: appObjectId, + name: 'GitHubWorkAccount', + dataType: 'String', + targetObjects: 'User', + verbose: true + }); + await command.action(logger, { options: parsedSchema.data }); assert(loggerLogSpy.calledOnceWithExactly(response)); }); @@ -248,7 +256,15 @@ describe(commands.DIRECTORYEXTENSION_ADD, () => { throw 'Invalid request'; }); - await command.action(logger, { options: { appId: appId, name: 'GitHubAccounts', dataType: 'String', targetObjects: 'User', isMultiValued: true } }); + + const parsedSchema = commandOptionsSchema.safeParse({ + appId: appId, + name: 'GitHubAccounts', + dataType: 'String', + targetObjects: 'User', + isMultiValued: true + }); + await command.action(logger, { options: parsedSchema.data }); assert(loggerLogSpy.calledOnceWithExactly(responseForMultiValued)); }); @@ -261,7 +277,14 @@ describe(commands.DIRECTORYEXTENSION_ADD, () => { throw 'Invalid request'; }); - await command.action(logger, { options: { appName: appName, name: 'ForServiceUseOnly', dataType: 'Boolean', targetObjects: 'User,Application,Device' } }); + + const parsedSchema = commandOptionsSchema.safeParse({ + appName: appName, + name: 'ForServiceUseOnly', + dataType: 'Boolean', + targetObjects: 'User,Application,Device' + }); + await command.action(logger, { options: parsedSchema.data }); assert(loggerLogSpy.calledOnceWithExactly(responseWithMultipleTargets)); }); @@ -277,6 +300,12 @@ describe(commands.DIRECTORYEXTENSION_ADD, () => { } }); - await assert.rejects(command.action(logger, { options: { appId: appId, name: 'ForServiceUseOnly', dataType: 'Boolean', targetObjects: 'User,Application,Device' } }), new CommandError('An extension property exists with the name extension_7f5df2f49ed64df786d7eefbfc4ab091_ForServiceUseOnly.')); + const parsedSchema = commandOptionsSchema.safeParse({ + appId: appId, + name: 'ForServiceUseOnly', + dataType: 'Boolean', + targetObjects: 'User,Application,Device' + }); + await assert.rejects(command.action(logger, { options: parsedSchema.data }), new CommandError('An extension property exists with the name extension_7f5df2f49ed64df786d7eefbfc4ab091_ForServiceUseOnly.')); }); }); \ No newline at end of file