Skip to content

Commit 0de4529

Browse files
authored
fix: functions e2e tests on windows (#12745)
* fix: console integration test * fix: e2e test on Windows * fix: try this * fix: simplify single select * fix: try this * fix: undo that
1 parent 99026e1 commit 0de4529

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

packages/amplify-category-function/src/provider-utils/awscloudformation/service-walkthroughs/generalQuestionsWalkthrough.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ import { advancedSettingsList } from '../utils/constants';
88
* @param context The Amplify Context object
99
*/
1010
export async function generalQuestionsWalkthrough(context: any): Promise<Partial<FunctionParameters>> {
11-
return await inquirer.prompt(generalQuestions(context));
11+
return await inquirer.prompt(await generalQuestions(context));
1212
}
1313

14-
function generalQuestions(context: any): object[] {
14+
async function generalQuestions(context: any): Promise<object[]> {
15+
const existingLambdaFunctions = await context.amplify.getResourceStatus('function');
1516
return [
1617
{
1718
type: 'input',
1819
name: 'functionName',
1920
message: 'Provide an AWS Lambda function name:',
20-
validate: async (input: string) => {
21-
const lambdaFunctions = await context.amplify.getResourceStatus('function');
22-
const functionExists = lambdaFunctions.allResources.some((resource) => resource.resourceName === input);
21+
validate: (input: string) => {
22+
const functionExists = existingLambdaFunctions.allResources.some((resource) => resource.resourceName === input);
2323
if (functionExists) {
2424
return 'A function with this name already exists.';
2525
}

packages/amplify-e2e-core/src/categories/lambda-function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ const goTemplateChoices = ['Hello World'];
2727
const javaTemplateChoices = ['Hello World'];
2828

2929
const nodeJSTemplateChoices = [
30+
'AppSync - GraphQL API request (with IAM)',
3031
'CRUD function for DynamoDB (Integration with API Gateway)',
3132
'GraphQL Lambda Authorizer',
3233
'Hello World',
3334
'Lambda trigger',
3435
'Serverless ExpressJS function (Integration with API Gateway)',
35-
'AppSync - GraphQL API request (with IAM)',
3636
];
3737

3838
const pythonTemplateChoices = ['Hello World'];

packages/amplify-e2e-core/src/utils/selectors.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ export const moveDown = (chain: ExecutionContext, nMoves: number) =>
66
export const moveUp = (chain: ExecutionContext, nMoves: number) =>
77
Array.from(Array(nMoves).keys()).reduce((chain) => chain.send('k'), chain);
88

9-
export const singleSelect = <T>(chain: ExecutionContext, item: T, allChoices: T[]) => multiSelect(chain, [item], allChoices);
9+
export const singleSelect = <T>(chain: ExecutionContext, item: T, allChoices: T[]) => {
10+
moveDown(chain, allChoices.indexOf(item));
11+
chain.sendCarriageReturn();
12+
return chain;
13+
};
1014

1115
export const multiSelect = <T>(chain: ExecutionContext, items: T[] = [], allChoices: T[]) => {
1216
items

0 commit comments

Comments
 (0)