Skip to content

Commit

Permalink
Added default options + test verifying for command
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathijs Verbeeck committed May 22, 2022
1 parent 560550b commit 569c68d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ describe(commands.EVENTRECEIVER_LIST, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['receiverId', 'receiverName', 'receiverAssembly', 'receiverClass', 'sequenceNumber', 'synchronization', 'eventType', 'receiverUrl']);
});

it('fails validation if the specified site URL is not a valid SharePoint URL', () => {
const actual = command.validate({ options: { webUrl: 'site.com' } });
assert.notStrictEqual(actual, true);
Expand Down
4 changes: 4 additions & 0 deletions src/m365/spo/commands/eventreceiver/eventreceiver-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class SpoEventreceiverListCommand extends SpoCommand {
return 'Lists all the event receivers attached to the web, site or list (if any of the list options are filled in)';
}

public defaultProperties(): string[] | undefined {
return ['receiverId', 'receiverName', 'receiverAssembly', 'receiverClass', 'sequenceNumber', 'synchronization', 'eventType', 'receiverUrl'];
}

public getTelemetryProperties(args: CommandArgs): any {
const telemetryProps: any = super.getTelemetryProperties(args);
telemetryProps.listId = typeof args.options.listId !== 'undefined';
Expand Down

0 comments on commit 569c68d

Please sign in to comment.