Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-chambers committed Oct 17, 2024
1 parent d46767e commit 3eff113
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 0 deletions.
1 change: 1 addition & 0 deletions ndc-reference/countries.jsonl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{"id": 1, "name": "UK", "area_km2": 244376, "cities": [{"name": "London"}, {"name": "Birmingham"}, {"name": "Manchester"}, {"name": "Glasgow"}, {"name": "Liverpool"}, {"name": "Bristol"}, {"name": "Edinburgh"}, {"name": "Leeds"}, {"name": "Sheffield"}, {"name": "Newcastle"}, {"name": "Nottingham"}, {"name": "Cardiff"}, {"name": "Belfast"}, {"name": "Leicester"}, {"name": "Coventry"}, {"name": "Sunderland"}, {"name": "Brighton"}, {"name": "Hull"}, {"name": "Plymouth"}, {"name": "Derby"}]}
{"id": 2, "name": "Sweden", "area_km2": 450295, "cities": [{"name": "Stockholm"}, {"name": "Gothenburg"}, {"name": "Malmö"}, {"name": "Uppsala"}, {"name": "Västerås"}, {"name": "Örebro"}, {"name": "Linköping"}, {"name": "Helsingborg"}]}
{"id": 3, "name": "Australia", "area_km2": 7688287, "cities": [{"name": "Melbourne"}, {"name": "Sydney"}, {"name": "Brisbane"}, {"name": "Adelaide"}, {"name": "Canberra"}, {"name": "Perth"}, {"name": "Darwin"}, {"name": "Hobart"}]}
{"id": 4, "name": "Mars", "area_km2": 144798500, "cities": []}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"rows": [
{
"id": 2,
"name": "Chalmers University of Technology",
"location": {
"campuses": [
"Johanneberg",
"Lindholmen"
]
}
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"$schema": "../../../../ndc-models/tests/json_schema/query_request.jsonschema",
"collection": "institutions",
"arguments": {},
"query": {
"fields": {
"id": {
"type": "column",
"column": "id"
},
"name": {
"type": "column",
"column": "name"
},
"location": {
"type": "column",
"column": "location",
"fields": {
"type": "object",
"fields": {
"campuses": {
"type": "column",
"column": "campuses",
"arguments": {
"limit": {
"type": "literal",
"value": null
}
}
}
}
}
}
},
"predicate": {
"type": "array_comparison",
"column": {
"type": "column",
"name": "location",
"field_path": ["campuses"]
},
"comparison": {
"type": "contains",
"value": {
"type": "scalar",
"value": "Lindholmen"
}
}
}
},
"collection_relationships": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"rows": [
{
"id": 4,
"name": "Mars",
"cities": []
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "../../../../ndc-models/tests/json_schema/query_request.jsonschema",
"collection": "countries",
"arguments": {},
"query": {
"fields": {
"id": {
"type": "column",
"column": "id"
},
"name": {
"type": "column",
"column": "name"
},
"cities": {
"type": "column",
"column": "cities",
"arguments": {
"limit": {
"type": "literal",
"value": null
}
}
}
},
"predicate": {
"type": "array_comparison",
"column": {
"type": "column",
"name": "cities",
"arguments": {
"limit": {
"type": "literal",
"value": null
}
}
},
"comparison": {
"type": "is_empty"
}
}
},
"collection_relationships": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"rows": [
{
"id": 1,
"name": "Queen Mary University of London",
"location": {
"campuses": [
"Mile End",
"Whitechapel",
"Charterhouse Square",
"West Smithfield"
]
}
},
{
"id": 2,
"name": "Chalmers University of Technology",
"location": {
"campuses": [
"Johanneberg",
"Lindholmen"
]
}
}
]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$schema": "../../../../ndc-models/tests/json_schema/query_request.jsonschema",
"collection": "institutions",
"arguments": {},
"query": {
"fields": {
"id": {
"type": "column",
"column": "id"
},
"name": {
"type": "column",
"column": "name"
},
"location": {
"type": "column",
"column": "location",
"fields": {
"type": "object",
"fields": {
"campuses": {
"type": "column",
"column": "campuses",
"arguments": {
"limit": {
"type": "literal",
"value": null
}
}
}
}
}
}
},
"predicate": {
"type": "exists",
"in_collection": {
"type": "nested_scalar_collection",
"column_name": "location",
"field_path": ["campuses"],
"arguments": {}
},
"predicate": {
"type": "binary_comparison_operator",
"column": {
"type": "column",
"name": "__value"
},
"operator": "like",
"value": {
"type": "scalar",
"value": "d"
}
}
}
},
"collection_relationships": {}
}

0 comments on commit 3eff113

Please sign in to comment.