Skip to content

Commit 407e479

Browse files
committed
Fix: unclear naming on unit test schema fields
1 parent 2e007d4 commit 407e479

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/appsync-modelgen-plugin/src/__tests__/utils/process-connections-v2.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ describe('GraphQL V2 process connections tests', () => {
1818
const hasOneWithFieldsSchema = /* GraphQL */ `
1919
type BatteryCharger @model {
2020
chargerID: ID!
21-
powerSource: PowerSource @hasOne(fields: ["chargerID"])
21+
powerSourceID: ID
22+
powerSource: PowerSource @hasOne(fields: ["powerSourceID"])
2223
}
2324
2425
type PowerSource @model {
@@ -79,12 +80,19 @@ describe('GraphQL V2 process connections tests', () => {
7980
name: 'chargerID',
8081
directives: []
8182
},
83+
{
84+
type: 'ID',
85+
isNullable: true,
86+
isList: false,
87+
name: 'powerSourceID',
88+
directives: []
89+
},
8290
{
8391
type: 'PowerSource',
8492
isNullable: true,
8593
isList: false,
8694
name: 'powerSource',
87-
directives: [{ name: 'hasOne', arguments: { fields: ['chargerID'] } }],
95+
directives: [{ name: 'hasOne', arguments: { fields: ['powerSourceID'] } }],
8896
},
8997
],
9098
},
@@ -307,7 +315,7 @@ describe('GraphQL V2 process connections tests', () => {
307315
expect(connectionInfo.isConnectingFieldAutoCreated).toEqual(true);
308316
});
309317
it('Should support @hasOne with an explicit primary key', () => {
310-
const powerSourceField = hasOneWithFieldsModelMap.BatteryCharger.fields[1];
318+
const powerSourceField = hasOneWithFieldsModelMap.BatteryCharger.fields[2];
311319
const connectionInfo = (processConnectionsV2(powerSourceField, hasOneWithFieldsModelMap.BatteryCharger, hasOneWithFieldsModelMap)) as CodeGenFieldConnectionHasOne;
312320
expect(connectionInfo).toBeDefined();
313321
expect(connectionInfo.kind).toEqual(CodeGenConnectionType.HAS_ONE);

0 commit comments

Comments
 (0)