Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1769df8

Browse files
committedOct 5, 2021
nonnull fields with aliases tests passing
1 parent bb91eac commit 1769df8

File tree

1 file changed

+93
-3
lines changed

1 file changed

+93
-3
lines changed
 

‎src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts

+93-3
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ describe('Validate: Overlapping fields can be merged', () => {
719719
]);
720720
});
721721

722-
describe('nullable field on types which potentially overlap', () => {
722+
describe('Nullable field on types which potentially overlap', () => {
723723
it('matching required status', () => {
724724
expectValidWithSchema(
725725
schema,
@@ -955,7 +955,7 @@ describe('Validate: Overlapping fields can be merged', () => {
955955
});
956956
});
957957

958-
describe('non-nullable field on types which potentially overlap', () => {
958+
describe('Non-nullable field on types which potentially overlap', () => {
959959
it('matching required status', () => {
960960
expectValidWithSchema(
961961
schema,
@@ -1082,7 +1082,61 @@ describe('Validate: Overlapping fields can be merged', () => {
10821082
]);
10831083
});
10841084

1085-
it('conflicting nullability status with aliases', () => {
1085+
it('conflicting requred and optional nullability status with aliases', () => {
1086+
expectValidWithSchema(
1087+
schema,
1088+
`
1089+
{
1090+
someBox {
1091+
...on NonNullStringBox1 {
1092+
nonNullable: scalar!
1093+
}
1094+
...on NonNullStringBox1Impl {
1095+
nullable: scalar?
1096+
}
1097+
}
1098+
}
1099+
`,
1100+
);
1101+
});
1102+
1103+
it('matching optional and optional nullability status with aliases', () => {
1104+
expectValidWithSchema(
1105+
schema,
1106+
`
1107+
{
1108+
someBox {
1109+
...on NonNullStringBox1 {
1110+
alsoNullable: scalar?
1111+
}
1112+
...on NonNullStringBox1Impl {
1113+
nullable: scalar?
1114+
}
1115+
}
1116+
}
1117+
`,
1118+
);
1119+
});
1120+
1121+
it('matching required and required nullability status with aliases', () => {
1122+
expectValidWithSchema(
1123+
schema,
1124+
`
1125+
{
1126+
someBox {
1127+
...on NonNullStringBox1 {
1128+
nonNullable: scalar!
1129+
}
1130+
...on NonNullStringBox1Impl {
1131+
alsoNonNullable: scalar!
1132+
}
1133+
}
1134+
}
1135+
`,
1136+
);
1137+
});
1138+
1139+
it('conflicting required and unset (requred) nullability status with aliases', () => {
10861140
expectValidWithSchema(
10871141
schema,
10881142
`
@@ -1099,6 +1153,42 @@ describe('Validate: Overlapping fields can be merged', () => {
10991153
`,
11001154
);
11011155
});
1156+
1157+
it('matching optional and unset (required) nullability status with aliases', () => {
1158+
expectValidWithSchema(
1159+
schema,
1160+
`
1161+
{
1162+
someBox {
1163+
...on NonNullStringBox1 {
1164+
nullable: scalar?
1165+
}
1166+
...on NonNullStringBox1Impl {
1167+
nonNullable: scalar
1168+
}
1169+
}
1170+
}
1171+
`,
1172+
);
1173+
});
1174+
1175+
it('matching unset (required) and unset (required) nullability status with aliases', () => {
1176+
expectValidWithSchema(
1177+
schema,
1178+
`
1179+
{
1180+
someBox {
1181+
...on NonNullStringBox1 {
1182+
nonNullable: scalar
1183+
}
1184+
...on NonNullStringBox1Impl {
1185+
alsoNonNullable: scalar
1186+
}
1187+
}
1188+
}
1189+
`,
1190+
);
1191+
});
11021192
});
11031193

11041194
describe('Exclusive types without aliases', () => {

0 commit comments

Comments
 (0)