From f8c57c14ef4226974044717bcc80c5adfdb173d8 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Fri, 7 Dec 2018 16:37:22 +0000 Subject: [PATCH] More notNull tests --- .../__snapshots__/queries.test.js.snap | 26 +++++++++++++++++++ .../smart_comment_relations.test.js.snap | 4 +-- .../__tests__/kitchen-sink-schema.sql | 7 +++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/packages/postgraphile-core/__tests__/integration/__snapshots__/queries.test.js.snap b/packages/postgraphile-core/__tests__/integration/__snapshots__/queries.test.js.snap index 412dd3083..e4bd7f2d4 100644 --- a/packages/postgraphile-core/__tests__/integration/__snapshots__/queries.test.js.snap +++ b/packages/postgraphile-core/__tests__/integration/__snapshots__/queries.test.js.snap @@ -7370,6 +7370,32 @@ Object { }, }, }, + Object { + "buildingByBuildingId": null, + "buildingId": null, + "buildingName": null, + "propertyByPropertyId": Object { + "id": 2, + "nameOrNumber": "10", + "nodeId": "WyJwcm9wZXJ0aWVzIiwyXQ==", + "streetByStreetId": Object { + "id": 1, + "name": "My Street", + "nodeId": "WyJzdHJlZXRzIiwxXQ==", + }, + "streetId": 1, + }, + "propertyId": 2, + "propertyNameOrNumber": "10", + "streetByStreetId": Object { + "id": 1, + "name": "My Street", + "nodeId": "WyJzdHJlZXRzIiwxXQ==", + }, + "streetId": 1, + "streetName": "My Street", + "streetPropertyByStreetIdAndPropertyId": null, + }, Object { "buildingByBuildingId": Object { "floors": 3, diff --git a/packages/postgraphile-core/__tests__/integration/schema/__snapshots__/smart_comment_relations.test.js.snap b/packages/postgraphile-core/__tests__/integration/schema/__snapshots__/smart_comment_relations.test.js.snap index fd58d1cd8..5b0ef876e 100644 --- a/packages/postgraphile-core/__tests__/integration/schema/__snapshots__/smart_comment_relations.test.js.snap +++ b/packages/postgraphile-core/__tests__/integration/schema/__snapshots__/smart_comment_relations.test.js.snap @@ -505,12 +505,12 @@ type House implements Node { \\"\\"\\"Reads a single \`Property\` that is related to this \`House\`.\\"\\"\\" propertyByPropertyId: Property propertyId: Int! - propertyNameOrNumber: String + propertyNameOrNumber: String! \\"\\"\\"Reads a single \`Street\` that is related to this \`House\`.\\"\\"\\" streetByStreetId: Street streetId: Int! - streetName: String + streetName: String! \\"\\"\\"Reads a single \`StreetProperty\` that is related to this \`House\`.\\"\\"\\" streetPropertyByStreetIdAndPropertyId: StreetProperty diff --git a/packages/postgraphile-core/__tests__/kitchen-sink-schema.sql b/packages/postgraphile-core/__tests__/kitchen-sink-schema.sql index 9464ec41e..4455bc117 100644 --- a/packages/postgraphile-core/__tests__/kitchen-sink-schema.sql +++ b/packages/postgraphile-core/__tests__/kitchen-sink-schema.sql @@ -903,10 +903,10 @@ create view smart_comment_relations.houses as ( properties.id as property_id, buildings.floors from smart_comment_relations.properties - inner join smart_comment_relations.buildings - on (buildings.property_id = properties.id and buildings.is_primary is true) inner join smart_comment_relations.streets on (properties.street_id = streets.id) + left join smart_comment_relations.buildings + on (buildings.property_id = properties.id and buildings.is_primary is true) ); comment on view smart_comment_relations.houses is E'@primaryKey street_id,property_id @foreignKey (street_id) references smart_comment_relations.streets @@ -914,3 +914,6 @@ comment on view smart_comment_relations.houses is E'@primaryKey street_id,proper @foreignKey (property_id) references properties @foreignKey (street_id, property_id) references street_property (str_id, prop_id) '; + +comment on column smart_comment_relations.houses.property_name_or_number is E'@notNull'; +comment on column smart_comment_relations.houses.street_name is E'@notNull';