Skip to content
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

Add DataStore/API integration test for a model with all supported types #314

Closed
lawmicha opened this issue Feb 12, 2020 · 6 comments
Closed
Assignees
Labels
api Issues related to the API category closing soon This issue will be closed in 7 days unless further comments are made. datastore Issues related to the DataStore category documentation Documentation improvements

Comments

@lawmicha
Copy link
Contributor

This would be a follow up task after @drochetti's work Date/Enum/Primitive support, We should add an integration test which contains a model with all of the supported types

@lawmicha lawmicha added api Issues related to the API category datastore Issues related to the DataStore category labels Feb 12, 2020
@lawmicha
Copy link
Contributor Author

we should also make sure mutating and querying for AppSync Floats with values that are at the upper limit is working or if there are some limitations, document what is the maximum value possible

drochetti added a commit that referenced this issue Mar 5, 2020
This fixes problems reported in several issues:  #111 #240 #246 #318 #314

**Notes:**

- added support for SQLite to handle Enums
- added support for SQLite to handle non-model types:
  - custom Codable structs
  - codable arrays
- added tests to make sure the right values are represented as SQLite
bindings
- remove field type string representation
- re-organized schema related files
- add support for Enum and non-model types
- remove commented code
- fix SQLite Int64 precision
- improve documentation and test cases
- better error handling and parameter naming
- addressed PR feedback
- add tests for `AnyEncodable`
- renamed variables for improved readability
- improved error message
- minor naming changes to address PR feedback
- update cocoapods version to be in sync with master

**Tests:**

- added a model that has all types of fields to make it easier to
visualize how data is represented on SQLite

**Pending:**

- More documentation
- GraphQL clenup on API category
@lawmicha lawmicha added the documentation Documentation improvements label Jul 7, 2020
@drochetti drochetti added the pending-triage Issue is pending triage label Jul 13, 2020
@lawmicha
Copy link
Contributor Author

we could take https://github.com/aws-amplify/amplify-ios/blob/main/AmplifyTestCommon/Models/QPredGen.swift and use the schema

/*
 Generated from:
 type QPredGen @model {
   id: ID!
   name: String!
   myBool: Boolean
   myDouble: Float
   myInt: Int
   myString: String
   myDate: AWSDate
   myDateTime: AWSDateTime
   myTime: AWSTime
 }
 */

in both of the integration tests in DataStore and API

@kjones
Copy link

kjones commented Jan 22, 2021

Other possible scalars to test: https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html
Are all these supported?

Other scenarios could include all combinations of nullable fields.

type TestModel @model {
  id: ID!
  testInt: Int!
  nullableInt: Int
  intList: [Int!]!
  intNullableList: [Int!]
  nullableIntList: [Int]!
  nullableIntNullableList: [Int]
}

Enums and nested types have also been problematic in the past so having tests for them might be useful.

type EnumTestModel @model {
  enumVal: TestEnum!
  nullableEnumVal: TestEnum
  enumList: [TestEnum!]!
  enumNullableList: [TestEnum!]
  nullableEnumList: [TestEnum]!
  nullableEnumNullableList: [TestEnum]
}

enum TestEnum {
  VALUE_ONE
  VALUE_TWO
}

type NestedTypeTestModel @model {
  nestedVal: Nested!
  nullableNestedVal: Nested
  nestedList: [Nested!]!
  nestedNullableList: [Nested!]
  nullableNestedList: [Nested]!
  nullableNestedNullableList: [Nested]
}

type Nested {
  valueOne: Int
  valueTwo: String
}

@lawmicha
Copy link
Contributor Author

lawmicha commented Apr 1, 2021

Thanks @kjones, those are great examples. I've used them almost exactly in this PR: #1135

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 14 days with no activity. Please, provide an update or it will be automatically closed in 7 days.

@github-actions github-actions bot added the closing soon This issue will be closed in 7 days unless further comments are made. label Apr 16, 2021
@github-actions
Copy link
Contributor

This issue is being automatically closed due to inactivity. If you believe it was closed by mistake, provide an update and re-open it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to the API category closing soon This issue will be closed in 7 days unless further comments are made. datastore Issues related to the DataStore category documentation Documentation improvements
Projects
None yet
Development

No branches or pull requests

3 participants