Skip to content

Commit d1fae2c

Browse files
committed
Add test for filtering on computed column with optional args
1 parent 7771714 commit d1fae2c

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

__tests__/fixtures/queries/computedColumns.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
query {
22
computed_equalTo_test_computed: allFilterables(filter: { computed: { equalTo: "test computed" } }) { ...computedConnection }
3+
computed_equalTo_test_computed_with_optional: allFilterables(filter: { computedWithOptional: { equalTo: "test default" } }) { ...computedConnection }
34
computedIntArray_equalTo_2_20: allFilterables(filter: { computedIntArray: { equalTo: [2, 20] } }) { ...computedConnection }
45
computedIntArray_equalTo_empty: allFilterables(filter: { computedIntArray: { equalTo: [] } }) { ...computedConnection }
56
allFilterables_computedSetofChild_name_equalTo_child2: allFilterables { nodes { id, computedSetofChild(filter: { name: { equalTo: "child2" } }) { ...childConnection } } }

__tests__/integration/__snapshots__/queries.test.ts.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5433,6 +5433,13 @@ exports[`computedColumns.graphql 1`] = `
54335433
},
54345434
],
54355435
},
5436+
"computed_equalTo_test_computed_with_optional": {
5437+
"nodes": [
5438+
{
5439+
"id": 4,
5440+
},
5441+
],
5442+
},
54365443
"filterableById_1_computedSetofChild_name_equalTo_child2": {
54375444
"computedSetofChild": {
54385445
"nodes": [

__tests__/p-schema.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ create function p.filterable_computed(filterable p.filterable) returns text as $
223223
select filterable."text" || ' computed'
224224
$$ language sql stable;
225225

226+
create function p.filterable_computed_with_optional(filterable p.filterable, suffix text = ' default') returns text as $$
227+
select filterable."text" || suffix
228+
$$ language sql stable;
229+
226230
create function p.filterable_computed2(filterable p.filterable) returns text as $$
227231
select filterable."text" || ' computed2'
228232
$$ language sql stable;

0 commit comments

Comments
 (0)