Skip to content

Commit 6457501

Browse files
committed
fix: init step for e2e test
1 parent b82e3e4 commit 6457501

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

packages/amplify-codegen-e2e-core/src/init/initProjectHelper.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@ export function initAndroidProjectWithProfile(cwd: string, settings: Object): Pr
108108
.wait('Choose your default editor:')
109109
.sendLine(s.editor)
110110
.wait("Choose the type of app that you're building")
111-
.send('j')
112-
.sendCarriageReturn()
111+
.sendLine('android')
113112
.wait('Where is your Res directory')
114113
.sendLine(s.srcDir)
115114
.wait('Select the authentication method you want to use:')
@@ -190,8 +189,7 @@ export function initFlutterProjectWithProfile(cwd: string, settings: Object): Pr
190189
.wait('Choose your default editor:')
191190
.sendLine(s.editor)
192191
.wait("Choose the type of app that you're building")
193-
.sendKeyDown(2)
194-
.sendCarriageReturn()
192+
.sendLine('flutter')
195193
.wait('Where do you want to store your configuration file')
196194
.sendLine(s.srcDir)
197195
.wait('Using default provider awscloudformation')

packages/amplify-codegen/tests/codegen-config/getCodegenConfig.test.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const { getCodegenConfig } = require('../../src/codegen-config');
22
const fs = require('fs-extra');
33
const graphQLConfig = require('graphql-config');
4+
const path = require('path');
45

56
jest.mock('fs-extra');
67
jest.mock('graphql-config');
@@ -50,10 +51,10 @@ describe('get codegen configuration', () => {
5051
fs.existsSync = jest.fn().mockReturnValue(true);
5152
graphQLConfig.getGraphQLConfig = jest.fn().mockReturnValue(MOCK_CODEGEN_CONFIG);
5253
const getConfigReturn = getCodegenConfig(MOCK_PROJECT_ROOT);
53-
expect(getConfigReturn.getGeneratedQueriesPath()).toEqual('src/graphql/queries');
54-
expect(getConfigReturn.getGeneratedMutationsPath()).toEqual('src/graphql/mutations');
55-
expect(getConfigReturn.getGeneratedSubscriptionsPath()).toEqual('src/graphql/subscriptions');
56-
expect(getConfigReturn.getGeneratedFragmentsPath()).toEqual('src/graphql/fragments');
54+
expect(getConfigReturn.getGeneratedQueriesPath()).toEqual(path.join('src', 'graphql', 'queries'));
55+
expect(getConfigReturn.getGeneratedMutationsPath()).toEqual(path.join('src', 'graphql', 'mutations'));
56+
expect(getConfigReturn.getGeneratedSubscriptionsPath()).toEqual(path.join('src', 'graphql', 'subscriptions'));
57+
expect(getConfigReturn.getGeneratedFragmentsPath()).toEqual(path.join('src', 'graphql', 'fragments'));
5758
});
5859

5960
it('uses the includes property if the generated documents path does not exist', () => {
@@ -62,17 +63,17 @@ describe('get codegen configuration', () => {
6263
fs.existsSync = jest.fn().mockReturnValue(true);
6364
graphQLConfig.getGraphQLConfig = jest.fn().mockReturnValue(configWithoutDocumentsPath);
6465
const getConfigReturn = getCodegenConfig(MOCK_PROJECT_ROOT);
65-
expect(getConfigReturn.getGeneratedQueriesPath()).toEqual('src/graphql/queries');
66-
expect(getConfigReturn.getGeneratedMutationsPath()).toEqual('src/graphql/mutations');
67-
expect(getConfigReturn.getGeneratedSubscriptionsPath()).toEqual('src/graphql/subscriptions');
68-
expect(getConfigReturn.getGeneratedFragmentsPath()).toEqual('src/graphql/fragments');
66+
expect(getConfigReturn.getGeneratedQueriesPath()).toEqual(path.join('src', 'graphql', 'queries'));
67+
expect(getConfigReturn.getGeneratedMutationsPath()).toEqual(path.join('src', 'graphql', 'mutations'));
68+
expect(getConfigReturn.getGeneratedSubscriptionsPath()).toEqual(path.join('src', 'graphql', 'subscriptions'));
69+
expect(getConfigReturn.getGeneratedFragmentsPath()).toEqual(path.join('src', 'graphql', 'fragments'));
6970
});
7071

7172
it('correctly returns the generated types path if exists', () => {
7273
fs.existsSync = jest.fn().mockReturnValue(true);
7374
graphQLConfig.getGraphQLConfig = jest.fn().mockReturnValue(MOCK_CODEGEN_CONFIG);
7475
const getConfigReturn = getCodegenConfig(MOCK_PROJECT_ROOT);
75-
expect(getConfigReturn.getGeneratedTypesPath()).toEqual('src/API.ts');
76+
expect(getConfigReturn.getGeneratedTypesPath()).toEqual(path.join('src', 'API.ts'));
7677
});
7778

7879
it('returns undefined if types path does not exist', () => {

0 commit comments

Comments
 (0)