Skip to content

Commit

Permalink
fix: update tests for new validation (#701)
Browse files Browse the repository at this point in the history
* fix: update tests for new validation

* chore: bump deps, update snapshots

* Update .changeset/rich-pumas-know.md

Co-authored-by: Kamil Sobol <sobkamil@amazon.com>

---------

Co-authored-by: Kamil Sobol <sobkamil@amazon.com>
  • Loading branch information
alharris-at and sobolk authored Nov 18, 2023
1 parent 14274f4 commit a2ed0ae
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 46 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-pumas-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend-data': patch
---

Update data-schema version
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/backend-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-amplify/data-schema": "^0.12.5",
"@aws-amplify/data-schema": "^0.12.9",
"@aws-amplify/backend-platform-test-stubs": "^0.3.0",
"@aws-amplify/platform-core": "^0.2.2"
},
Expand All @@ -31,6 +31,6 @@
"@aws-amplify/backend-output-schemas": "^0.4.0",
"@aws-amplify/data-construct": "^1.4.1",
"@aws-amplify/plugin-types": "^0.4.1",
"@aws-amplify/data-schema-types": "^0.6.3"
"@aws-amplify/data-schema-types": "^0.6.6"
}
}
32 changes: 18 additions & 14 deletions packages/backend-data/src/convert_schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,20 @@ void describe('convertSchemaToCDK', () => {

void it('generates for a typed schema', () => {
const expectedGraphqlSchema = /* GraphQL */ `
type Todo @model {
type Todo @model @auth(rules: [{ allow: public }]) {
id: ID! @primaryKey
content: String!
createdAt: AWSDateTime!
updatedAt: AWSDateTime!
}
`;
const typedSchema = a.schema({
Todo: a.model({
content: a.string().required(),
}),
});
const typedSchema = a
.schema({
Todo: a.model({
content: a.string().required(),
}),
})
.authorization([a.allow.public()]);
const convertedDefinition = convertSchemaToCDK(typedSchema);
assert.deepEqual(
removeWhiteSpaceForComparison(convertedDefinition.schema),
Expand All @@ -54,14 +56,16 @@ void describe('convertSchemaToCDK', () => {
});

void it('produces appropriate dataSourceStrategies for a typed schema with multiple models', () => {
const typedSchema = a.schema({
Todo: a.model({
content: a.string().required(),
}),
Blog: a.model({
title: a.string(),
}),
});
const typedSchema = a
.schema({
Todo: a.model({
content: a.string().required(),
}),
Blog: a.model({
title: a.string(),
}),
})
.authorization([a.allow.public()]);
const convertedDefinition = convertSchemaToCDK(typedSchema);
assert.deepEqual(convertedDefinition.dataSourceStrategies, {
Todo: {
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@aws-amplify/data-schema": "^0.12.5",
"@aws-amplify/data-schema": "^0.12.9",
"@aws-amplify/backend-auth": "^0.3.2",
"@aws-amplify/backend-function": "^0.2.2",
"@aws-amplify/backend-data": "^0.8.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/30437774f1c71227196609658884b062fb7cc1a490f4a99234540e8a51b2c60b.json"
"/49db5c096a6e16028208ca156161ed85e1c77d49d3073bdb7957432865a50618.json"
]
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"ApiId"
]
},
"Expires": 1702847164
"Expires": 1702857469
}
},
"amplifyDataGraphQLAPINONEDS684BF699": {
Expand Down
2 changes: 1 addition & 1 deletion packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@aws-amplify/backend-auth": "0.3.3",
"@aws-amplify/backend-secret": "^0.3.0",
"@aws-amplify/backend-storage": "0.3.0",
"@aws-amplify/data-schema": "^0.12.5",
"@aws-amplify/data-schema": "^0.12.9",
"@aws-sdk/client-amplify": "^3.440.0",
"@aws-sdk/client-cloudformation": "^3.421.0",
"@aws-amplify/platform-core": "^0.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/d6e0314b1ac09ff28a99badfe9e99092404a3ec665a87b7790a3a7d354d39f88.json"
"/1f9170d47be7a5554c0c68803291a57060ec87ed69a3225c34a56eb1a53d5831.json"
]
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"ApiId"
]
},
"Expires": 1700859954
"Expires": 1700870257
}
},
"amplifyDataGraphQLAPINONEDS684BF699": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/a1ae1b3815e3a2aa0075b529cf24f525b5274c558ef80670435864e040d30d05.json"
"/c29dc8507624b0ff3eb73073f8de1d4e8998ddf5fb5f8e674b16f5f372b912ab.json"
]
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"ApiId"
]
},
"Expires": 1702847162
"Expires": 1702857466
}
},
"amplifyDataGraphQLAPINONEDS684BF699": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
{
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"/56ff54712934bfae19cc63d8f507aa3814a24d00c53b20fff17034fd3002185a.json"
"/2575b6782317dd85e53f20cf5cb843d0e82f91a3bf6664b9f097790fd5056b43.json"
]
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"ApiId"
]
},
"Expires": 1700859963
"Expires": 1700870267
}
},
"amplifyDataGraphQLAPINONEDS684BF699": {
Expand Down

0 comments on commit a2ed0ae

Please sign in to comment.