Skip to content

Commit 4bbb565

Browse files
author
Dane Pilcher
committed
test: fix add api and schema
1 parent fc255cd commit 4bbb565

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

packages/amplify-codegen-e2e-tests/src/__tests__/build-app-android.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {
2-
initProjectWithQuickstart,
2+
initProjectWithProfile,
33
DEFAULT_ANDROID_CONFIG,
44
updateApiSchemaWithText,
5+
addApiWithBlankSchemaAndConflictDetection,
56
generateModels,
67
generateStatementsAndTypes,
78
androidBuild,
@@ -25,8 +26,11 @@ describe('build app - Android', () => {
2526
const statementsDir = 'app/src/main/graphql/com/amazonaws/amplify/generated/graphql';
2627

2728
beforeAll(async () => {
28-
await initProjectWithQuickstart(projectRoot, { ...config });
29+
await initProjectWithProfile(projectRoot, { ...config });
30+
await addApiWithBlankSchemaAndConflictDetection(projectRoot);
2931
apiName = readdirSync(path.join(projectRoot, 'amplify', 'backend', 'api'))[0];
32+
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${schemas[0].sdl}`;
33+
updateApiSchemaWithText(projectRoot, apiName, schemaText);
3034
await amplifyPush(projectRoot);
3135
await addCodegen(projectRoot, {
3236
frontendType: AmplifyFrontend.android,

packages/amplify-codegen-e2e-tests/src/__tests__/build-app-swift.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
2-
initProjectWithQuickstart,
2+
initProjectWithProfile,
3+
addApiWithBlankSchemaAndConflictDetection,
34
DEFAULT_IOS_CONFIG,
45
updateApiSchemaWithText,
56
generateModels,
@@ -27,8 +28,11 @@ describe('build app - Swift', () => {
2728
const config = DEFAULT_IOS_CONFIG;
2829

2930
beforeAll(async () => {
30-
await initProjectWithQuickstart(projectRoot, { ...config });
31+
await initProjectWithProfile(projectRoot, { ...config });
32+
await addApiWithBlankSchemaAndConflictDetection(projectRoot);
3133
apiName = readdirSync(path.join(projectRoot, 'amplify', 'backend', 'api'))[0];
34+
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${schemas[0].sdl}`;
35+
updateApiSchemaWithText(projectRoot, apiName, schemaText);
3236
await amplifyPush(projectRoot);
3337
await addCodegen(projectRoot, {
3438
frontendType: AmplifyFrontend.ios,

packages/amplify-codegen-e2e-tests/src/__tests__/build-app-ts.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ describe('build app - JS', () => {
2525
beforeAll(async () => {
2626
await initProjectWithProfile(projectRoot, { ...config });
2727
await addApiWithBlankSchemaAndConflictDetection(projectRoot);
28+
apiName = readdirSync(path.join(projectRoot, 'amplify', 'backend', 'api'))[0];
29+
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${schemas[0].sdl}`;
30+
updateApiSchemaWithText(projectRoot, apiName, schemaText);
2831
await amplifyPush(projectRoot);
2932
await addCodegen(projectRoot, {
3033
frontendType: AmplifyFrontend.javascript,
3134
});
3235
await craInstall(projectRoot, { ...config });
33-
apiName = readdirSync(path.join(projectRoot, 'amplify', 'backend', 'api'))[0];
3436
});
3537

3638
afterAll(async () => {

0 commit comments

Comments
 (0)