Skip to content

chore(datastore): added unit tests for Amplify Api Native Bridge #4983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 7, 2024

Conversation

tyllark
Copy link
Member

@tyllark tyllark commented Jun 5, 2024

Description of changes:

  • Made _NativeAmplifyApi visible for testing purposes
  • Added unit tests for DataStores native API bridge interface
    • query
    • mutate
    • subscribe
    • unsubscribe

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Unit tests for Query, Mutate, Subscribe, and Unsubscribe
@tyllark tyllark requested a review from a team as a code owner June 5, 2024 19:53
Copy link
Contributor

@Equartey Equartey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice job so far!

group('NativeAmplifyAPI', () {
group('Query', () {
test('Should handle empty request/response', () async {
String document = '';
Copy link
Member

@Jordan-Nelson Jordan-Nelson Jun 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: DataStore doesn't follow amplify lints, but just an fyi in other packages where amplify_lints using final is enforced for local vars that are not mutated. The same probably applies to other lint rules.

I am going to see how much work enable amplify_lints in datastore will be. If/when it is added these are updates dart fix will make automatically.

You don't need to update these. Just wanted to make a note.

return GraphQLOperation<String>(
CancelableOperation<GraphQLResponse<String>>.fromValue(
GraphQLResponse<String>(
data: data as String?,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The fact that this is making you cast to String? is odd. I think this is a bug in Dart. I created a minimal repro of this and opened an issue: dart-lang/sdk#55958

@tyllark tyllark merged commit 6be9898 into main Jun 7, 2024
11 checks passed
Equartey pushed a commit that referenced this pull request Jun 10, 2024
* chore(datastore): added unit tests for Amplify Api Native Bridge

Unit tests for Query, Mutate, Subscribe, and Unsubscribe

* chore(datastore): updated Amplify Api Native Bridge unit tests per feedback

* chore(datastore): Formatted file
Jordan-Nelson pushed a commit that referenced this pull request Jun 27, 2024
* chore(datastore): added unit tests for Amplify Api Native Bridge

Unit tests for Query, Mutate, Subscribe, and Unsubscribe

* chore(datastore): updated Amplify Api Native Bridge unit tests per feedback

* chore(datastore): Formatted file
Jordan-Nelson pushed a commit that referenced this pull request Jun 27, 2024
* chore(datastore): added unit tests for Amplify Api Native Bridge

Unit tests for Query, Mutate, Subscribe, and Unsubscribe

* chore(datastore): updated Amplify Api Native Bridge unit tests per feedback

* chore(datastore): Formatted file
@tyllark tyllark deleted the chore/spm-native-bridge-unit-tests branch September 16, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants