File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
packages/appsync-modelgen-plugin/src/__tests__/visitors Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -897,4 +897,29 @@ describe('AppSyncModelVisitor', () => {
897897 expect ( visitor . models . ModelB . fields [ 1 ] . directives [ 0 ] . arguments . indexName ) . toEqual ( 'byModelB' ) ;
898898 } ) ;
899899 } ) ;
900+
901+ describe ( 'Graphql V2 fix tests for multiple has many relations of only one model type' , ( ) => {
902+ const schema = /* GraphQL*/ `
903+ type Registration @model {
904+ id: ID! @primaryKey
905+ meetingId: ID @index(name: "byMeeting", sortKeyFields: ["attendeeId"])
906+ meeting: Meeting! @belongsTo(fields: ["meetingId"])
907+ attendeeId: ID @index(name: "byAttendee", sortKeyFields: ["meetingId"])
908+ attendee: Attendee! @belongsTo(fields: ["attendeeId"])
909+ }
910+ type Meeting @model {
911+ id: ID! @primaryKey
912+ title: String!
913+ attendees: [Registration] @hasMany(indexName: "byMeeting", fields: ["id"])
914+ }
915+
916+ type Attendee @model {
917+ id: ID! @primaryKey
918+ meetings: [Registration] @hasMany(indexName: "byAttendee", fields: ["id"])
919+ }
920+ ` ;
921+ it ( `should not throw error when processing models` , ( ) => {
922+ expect ( ( ) => createAndGeneratePipelinedTransformerVisitor ( schema ) ) . not . toThrow ( ) ;
923+ } ) ;
924+ } )
900925} ) ;
You can’t perform that action at this time.
0 commit comments