Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds command flow recyclebinitem list #6214

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

milanholemans
Copy link
Contributor

Closes #6139

@milanholemans milanholemans changed the title Adds command 'flow recyclebinitem list' Adds command flow recyclebinitem list Aug 6, 2024
@MathijsVerbeeck MathijsVerbeeck self-assigned this Aug 14, 2024
Copy link
Contributor

@MathijsVerbeeck MathijsVerbeeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @milanholemans

Just some minor comments in your tests. Could you have a look at those?


describe(commands.OWNER_LIST, () => {
const environmentName = 'Default-d87a7535-dd31-4437-bfe1-95340acd55c6';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this empty line

Comment on lines +213 to +224
it('correctly retrieves deleted flows with output json', async () => {
sinon.stub(request, 'get').callsFake(async (opts) => {
if (opts.url === `https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/scopes/admin/environments/${formatting.encodeQueryParameter(environmentName)}/v2/flows?api-version=2016-11-01&include=softDeletedFlows`) {
return flowResponse;
}

throw 'Invalid request';
});

await command.action(logger, { options: { verbose: true, environmentName: environmentName } });
assert.deepStrictEqual(loggerLogSpy.firstCall.args[0], deletedFlows);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we combine this assert with the first json test? Now we are doing the exact same

Comment on lines +226 to +240
it('correctly retrieves deleted flows with output text', async () => {
sinon.stub(request, 'get').callsFake(async (opts) => {
if (opts.url === `https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/scopes/admin/environments/${formatting.encodeQueryParameter(environmentName)}/v2/flows?api-version=2016-11-01&include=softDeletedFlows`) {
return flowResponse;
}

throw 'Invalid request';
});

await command.action(logger, { options: { verbose: true, environmentName: environmentName, output: 'text' } });
const textResponse = deletedFlows.map(flow => ({ ...flow, displayName: flow.properties.displayName }));

assert.deepStrictEqual(loggerLogSpy.firstCall.args[0], textResponse);
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we combine this assert with the first text test? Now we are doing the exact same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to merge 2 tests? They are doing the same indeed but testing something different. AFAIK, in an ideal world, a test should have only 1 assert, so it checks exactly 1 thing.

@MathijsVerbeeck MathijsVerbeeck marked this pull request as draft August 15, 2024 16:32
@milanholemans milanholemans marked this pull request as ready for review August 20, 2024 14:08
Copy link
Contributor

@MathijsVerbeeck MathijsVerbeeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job. Will merge soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New command: flow recyclebinitem list
2 participants