Skip to content

Commit 7cdf553

Browse files
committed
fix(amplify-codegen): add integration tests
1 parent 1794b4e commit 7cdf553

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
type Product @model {
2+
id: ID!
3+
name: String!
4+
price: Float!
5+
}
6+
7+
type OrderSummary {
8+
orderId: ID!
9+
product: Product!
10+
quantity: Int!
11+
}
12+
13+
type Mutation {
14+
createOrder(productId: ID!, quantity: Int!): OrderSummary
15+
@function(name: "createOrder-${env}")
16+
}

packages/amplify-codegen-e2e-tests/src/__tests__/datastore-modelgen-ios.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { deleteAmplifyProject, testCodegenModels } from '../codegen-tests-base';
33
import * as path from 'path';
44

55
const schema = 'modelgen/model_gen_schema_with_aws_scalars.graphql';
6+
const customTypeWithModelRefSchema = 'modelgen/custom_type_with_model_reference.graphql';
67

78
describe('Datastore Modelgen tests - iOS', () => {
89
let projectRoot: string;
@@ -22,4 +23,8 @@ describe('Datastore Modelgen tests - iOS', () => {
2223
it(`should generate files at overridden location`, async () => {
2324
await testCodegenModels(DEFAULT_IOS_CONFIG, projectRoot, schema, path.join('amplification', 'manufactured', 'models'));
2425
});
26+
27+
it(`should generate correct syntax for custom types referencing @model types`, async () => {
28+
await testCodegenModels(DEFAULT_IOS_CONFIG, projectRoot, customTypeWithModelRefSchema);
29+
});
2530
});

0 commit comments

Comments
 (0)