Skip to content

Commit 344f2a2

Browse files
committed
test(collation): use C collation for test DB
1 parent 8904742 commit 344f2a2

15 files changed

+176
-173
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,11 @@ When `true`, passing `{}` as a field value is equivalent to omitting the field.
642642

643643
## Development
644644

645-
To establish a test environment, create an empty Postgres database (e.g. `graphile_build_test`) and set a `TEST_DATABASE_URL` environment variable with your connection string (e.g. `postgres://localhost:5432/graphile_build_test`). Ensure that `psql` is installed locally and then run:
645+
To establish a test environment, create an empty PostgreSQL database with C collation (required for consistent ordering of strings) and set a `TEST_DATABASE_URL` environment variable with your database connection string.
646+
646647
```bash
648+
createdb graphile_test_c --template template0 --lc-collate C
649+
export TEST_DATABASE_URL=postgres://localhost:5432/graphile_test_c
647650
yarn
648-
npm run test
649-
```
651+
yarn test
652+
```

__tests__/fixtures/queries/arrayTypes.bpchar4Array.graphql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
query bpchar4Array(
2-
$v2: [String] = ["tEST", "Test"]
3-
$v2_1: String = "tEST"
4-
$v3: [String] = ["Test", "TEST"]
2+
$v2: [String] = ["Test", "tEST"]
3+
$v2_1: String = "Test"
4+
$v3: [String] = ["tEST", "test"]
55
) {
66
anyEqualTo: allArrayTypes(filter: { bpchar4Array: { anyEqualTo: $v2_1 } }) {
77
...nodes

__tests__/fixtures/queries/arrayTypes.char4Array.graphql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
query char4Array(
2-
$v2: [String] = ["tEST", "Test"]
3-
$v2_1: String = "tEST"
4-
$v3: [String] = ["Test", "TEST"]
2+
$v2: [String] = ["Test", "tEST"]
3+
$v2_1: String = "Test"
4+
$v3: [String] = ["tEST", "test"]
55
) {
66
anyEqualTo: allArrayTypes(filter: { char4Array: { anyEqualTo: $v2_1 } }) {
77
...nodes

__tests__/fixtures/queries/arrayTypes.textArray.graphql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
query textArray(
2-
$v2: [String] = ["tEST", "Test"]
3-
$v2_1: String = "tEST"
4-
$v3: [String] = ["Test", "TEST"]
2+
$v2: [String] = ["Test", "tEST"]
3+
$v2_1: String = "Test"
4+
$v3: [String] = ["tEST", "test"]
55
) {
66
anyEqualTo: allArrayTypes(filter: { textArray: { anyEqualTo: $v2_1 } }) {
77
...nodes

__tests__/fixtures/queries/arrayTypes.varcharArray.graphql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
query varcharArray(
2-
$v2: [String] = ["tEST", "Test"]
3-
$v2_1: String = "tEST"
4-
$v3: [String] = ["Test", "TEST"]
2+
$v2: [String] = ["Test", "tEST"]
3+
$v2_1: String = "Test"
4+
$v3: [String] = ["tEST", "test"]
55
) {
66
anyEqualTo: allArrayTypes(filter: { varcharArray: { anyEqualTo: $v2_1 } }) {
77
...nodes

__tests__/fixtures/queries/computedColumns.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
query {
2-
computed_equalTo_TEST_computed: allFilterables(filter: { computed: { equalTo: "TEST computed" } }) { ...computedConnection }
2+
computed_equalTo_test_computed: allFilterables(filter: { computed: { equalTo: "test computed" } }) { ...computedConnection }
33
computedIntArray_equalTo_2_20: allFilterables(filter: { computedIntArray: { equalTo: [2, 20] } }) { ...computedConnection }
44
computedIntArray_equalTo_empty: allFilterables(filter: { computedIntArray: { equalTo: [] } }) { ...computedConnection }
55
allFilterables_computedSetofChild_name_equalTo_child2: allFilterables { nodes { id, computedSetofChild(filter: { name: { equalTo: "child2" } }) { ...childConnection } } }

__tests__/fixtures/queries/domainTypes.char4Domain.graphql

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
query char4Domain($v2: Char4Domain = "tEST", $v3: Char4Domain = "Test") {
1+
query char4Domain($v2: Char4Domain = "Test", $v3: Char4Domain = "tEST") {
22
distinctFrom: allDomainTypes(filter: { char4Domain: { distinctFrom: $v2 } }) {
33
...nodes
44
}
5-
endsWith: allDomainTypes(filter: { char4Domain: { endsWith: "t" } }) {
5+
endsWith: allDomainTypes(filter: { char4Domain: { endsWith: "T" } }) {
66
...nodes
77
}
88
endsWithInsensitive: allDomainTypes(
9-
filter: { char4Domain: { endsWithInsensitive: "t" } }
9+
filter: { char4Domain: { endsWithInsensitive: "T" } }
1010
) {
1111
...nodes
1212
}
@@ -24,11 +24,11 @@ query char4Domain($v2: Char4Domain = "tEST", $v3: Char4Domain = "Test") {
2424
in: allDomainTypes(filter: { char4Domain: { in: [$v2, $v3] } }) {
2525
...nodes
2626
}
27-
includes: allDomainTypes(filter: { char4Domain: { includes: "t" } }) {
27+
includes: allDomainTypes(filter: { char4Domain: { includes: "T" } }) {
2828
...nodes
2929
}
3030
includesInsensitive: allDomainTypes(
31-
filter: { char4Domain: { includesInsensitive: "t" } }
31+
filter: { char4Domain: { includesInsensitive: "T" } }
3232
) {
3333
...nodes
3434
}
@@ -43,11 +43,11 @@ query char4Domain($v2: Char4Domain = "tEST", $v3: Char4Domain = "Test") {
4343
) {
4444
...nodes
4545
}
46-
like: allDomainTypes(filter: { char4Domain: { like: "%es%" } }) {
46+
like: allDomainTypes(filter: { char4Domain: { like: "%ES%" } }) {
4747
...nodes
4848
}
4949
likeInsensitive: allDomainTypes(
50-
filter: { char4Domain: { likeInsensitive: "%es%" } }
50+
filter: { char4Domain: { likeInsensitive: "%ES%" } }
5151
) {
5252
...nodes
5353
}
@@ -56,11 +56,11 @@ query char4Domain($v2: Char4Domain = "tEST", $v3: Char4Domain = "Test") {
5656
) {
5757
...nodes
5858
}
59-
notEndsWith: allDomainTypes(filter: { char4Domain: { notEndsWith: "t" } }) {
59+
notEndsWith: allDomainTypes(filter: { char4Domain: { notEndsWith: "T" } }) {
6060
...nodes
6161
}
6262
notEndsWithInsensitive: allDomainTypes(
63-
filter: { char4Domain: { notEndsWithInsensitive: "t" } }
63+
filter: { char4Domain: { notEndsWithInsensitive: "T" } }
6464
) {
6565
...nodes
6666
}
@@ -70,47 +70,47 @@ query char4Domain($v2: Char4Domain = "tEST", $v3: Char4Domain = "Test") {
7070
notIn: allDomainTypes(filter: { char4Domain: { notIn: [$v2] } }) {
7171
...nodes
7272
}
73-
notIncludes: allDomainTypes(filter: { char4Domain: { notIncludes: "t" } }) {
73+
notIncludes: allDomainTypes(filter: { char4Domain: { notIncludes: "T" } }) {
7474
...nodes
7575
}
7676
notIncludesInsensitive: allDomainTypes(
77-
filter: { char4Domain: { notIncludesInsensitive: "t" } }
77+
filter: { char4Domain: { notIncludesInsensitive: "T" } }
7878
) {
7979
...nodes
8080
}
81-
notLike: allDomainTypes(filter: { char4Domain: { notLike: "%es%" } }) {
81+
notLike: allDomainTypes(filter: { char4Domain: { notLike: "%ES%" } }) {
8282
...nodes
8383
}
8484
notLikeInsensitive: allDomainTypes(
85-
filter: { char4Domain: { notLikeInsensitive: "%es%" } }
85+
filter: { char4Domain: { notLikeInsensitive: "%ES%" } }
8686
) {
8787
...nodes
8888
}
8989
notSimilarTo: allDomainTypes(
90-
filter: { char4Domain: { notSimilarTo: "%(te|st)%" } }
90+
filter: { char4Domain: { notSimilarTo: "%(TE|ST)%" } }
9191
) {
9292
...nodes
9393
}
9494
notStartsWith: allDomainTypes(
95-
filter: { char4Domain: { notStartsWith: "t" } }
95+
filter: { char4Domain: { notStartsWith: "T" } }
9696
) {
9797
...nodes
9898
}
9999
notStartsWithInsensitive: allDomainTypes(
100-
filter: { char4Domain: { notStartsWithInsensitive: "t" } }
100+
filter: { char4Domain: { notStartsWithInsensitive: "T" } }
101101
) {
102102
...nodes
103103
}
104104
similarTo: allDomainTypes(
105-
filter: { char4Domain: { similarTo: "%(te|st)%" } }
105+
filter: { char4Domain: { similarTo: "%(TE|ST)%" } }
106106
) {
107107
...nodes
108108
}
109-
startsWith: allDomainTypes(filter: { char4Domain: { startsWith: "t" } }) {
109+
startsWith: allDomainTypes(filter: { char4Domain: { startsWith: "T" } }) {
110110
...nodes
111111
}
112112
startsWithInsensitive: allDomainTypes(
113-
filter: { char4Domain: { startsWithInsensitive: "t" } }
113+
filter: { char4Domain: { startsWithInsensitive: "T" } }
114114
) {
115115
...nodes
116116
}

__tests__/fixtures/queries/logicalOperators.graphql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
query {
2-
int4_equalTo_2_or_text_endsWith_T: allFilterables(
3-
filter: { or: [{ int4: { equalTo: 2 } }, { text: { endsWith: "T" } }] }
2+
int4_equalTo_2_or_text_endsWith_t: allFilterables(
3+
filter: { or: [{ int4: { equalTo: 2 } }, { text: { endsWith: "t" } }] }
44
) {
55
...nodes
66
}
7-
int4_equalTo_2_and_text_endsWith_T: allFilterables(
8-
filter: { and: [{ int4: { equalTo: 2 } }, { text: { endsWith: "T" } }] }
7+
int4_equalTo_2_and_text_endsWith_t: allFilterables(
8+
filter: { and: [{ int4: { equalTo: 2 } }, { text: { endsWith: "t" } }] }
99
) {
1010
...nodes
1111
}
12-
not_text_equalTo_TEST: allFilterables(
13-
filter: { not: { text: { equalTo: "TEST" } } }
12+
not_text_equalTo_test: allFilterables(
13+
filter: { not: { text: { equalTo: "test" } } }
1414
) {
1515
...nodes
1616
}
17-
not_int4_equalTo_2_or_text_endsWith_T: allFilterables(
17+
not_int4_equalTo_2_or_text_endsWith_t: allFilterables(
1818
filter: {
19-
not: { or: [{ int4: { equalTo: 2 } }, { text: { endsWith: "T" } }] }
19+
not: { or: [{ int4: { equalTo: 2 } }, { text: { endsWith: "t" } }] }
2020
}
2121
) {
2222
...nodes

__tests__/fixtures/queries/types.bpchar4.graphql

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
query bpchar4($v2: String = "tEST", $v3: String = "Test") {
1+
query bpchar4($v2: String = "Test", $v3: String = "tEST") {
22
distinctFrom: allFilterables(filter: { bpchar4: { distinctFrom: $v2 } }) {
33
...nodes
44
}
5-
endsWith: allFilterables(filter: { bpchar4: { endsWith: "t" } }) {
5+
endsWith: allFilterables(filter: { bpchar4: { endsWith: "T" } }) {
66
...nodes
77
}
88
endsWithInsensitive: allFilterables(
9-
filter: { bpchar4: { endsWithInsensitive: "t" } }
9+
filter: { bpchar4: { endsWithInsensitive: "T" } }
1010
) {
1111
...nodes
1212
}
@@ -24,11 +24,11 @@ query bpchar4($v2: String = "tEST", $v3: String = "Test") {
2424
in: allFilterables(filter: { bpchar4: { in: [$v2, $v3] } }) {
2525
...nodes
2626
}
27-
includes: allFilterables(filter: { bpchar4: { includes: "t" } }) {
27+
includes: allFilterables(filter: { bpchar4: { includes: "T" } }) {
2828
...nodes
2929
}
3030
includesInsensitive: allFilterables(
31-
filter: { bpchar4: { includesInsensitive: "t" } }
31+
filter: { bpchar4: { includesInsensitive: "T" } }
3232
) {
3333
...nodes
3434
}
@@ -43,22 +43,22 @@ query bpchar4($v2: String = "tEST", $v3: String = "Test") {
4343
) {
4444
...nodes
4545
}
46-
like: allFilterables(filter: { bpchar4: { like: "%es%" } }) {
46+
like: allFilterables(filter: { bpchar4: { like: "%ES%" } }) {
4747
...nodes
4848
}
4949
likeInsensitive: allFilterables(
50-
filter: { bpchar4: { likeInsensitive: "%es%" } }
50+
filter: { bpchar4: { likeInsensitive: "%ES%" } }
5151
) {
5252
...nodes
5353
}
5454
notDistinctFrom: allFilterables(filter: { bpchar4: { notDistinctFrom: $v2 } }) {
5555
...nodes
5656
}
57-
notEndsWith: allFilterables(filter: { bpchar4: { notEndsWith: "t" } }) {
57+
notEndsWith: allFilterables(filter: { bpchar4: { notEndsWith: "T" } }) {
5858
...nodes
5959
}
6060
notEndsWithInsensitive: allFilterables(
61-
filter: { bpchar4: { notEndsWithInsensitive: "t" } }
61+
filter: { bpchar4: { notEndsWithInsensitive: "T" } }
6262
) {
6363
...nodes
6464
}
@@ -68,43 +68,43 @@ query bpchar4($v2: String = "tEST", $v3: String = "Test") {
6868
notIn: allFilterables(filter: { bpchar4: { notIn: [$v2] } }) {
6969
...nodes
7070
}
71-
notIncludes: allFilterables(filter: { bpchar4: { notIncludes: "t" } }) {
71+
notIncludes: allFilterables(filter: { bpchar4: { notIncludes: "T" } }) {
7272
...nodes
7373
}
7474
notIncludesInsensitive: allFilterables(
75-
filter: { bpchar4: { notIncludesInsensitive: "t" } }
75+
filter: { bpchar4: { notIncludesInsensitive: "T" } }
7676
) {
7777
...nodes
7878
}
79-
notLike: allFilterables(filter: { bpchar4: { notLike: "%es%" } }) {
79+
notLike: allFilterables(filter: { bpchar4: { notLike: "%ES%" } }) {
8080
...nodes
8181
}
8282
notLikeInsensitive: allFilterables(
83-
filter: { bpchar4: { notLikeInsensitive: "%es%" } }
83+
filter: { bpchar4: { notLikeInsensitive: "%ES%" } }
8484
) {
8585
...nodes
8686
}
8787
notSimilarTo: allFilterables(
88-
filter: { bpchar4: { notSimilarTo: "%(te|st)%" } }
88+
filter: { bpchar4: { notSimilarTo: "%(TE|ST)%" } }
8989
) {
9090
...nodes
9191
}
92-
notStartsWith: allFilterables(filter: { bpchar4: { notStartsWith: "t" } }) {
92+
notStartsWith: allFilterables(filter: { bpchar4: { notStartsWith: "T" } }) {
9393
...nodes
9494
}
9595
notStartsWithInsensitive: allFilterables(
96-
filter: { bpchar4: { notStartsWithInsensitive: "t" } }
96+
filter: { bpchar4: { notStartsWithInsensitive: "T" } }
9797
) {
9898
...nodes
9999
}
100-
similarTo: allFilterables(filter: { bpchar4: { similarTo: "%(te|st)%" } }) {
100+
similarTo: allFilterables(filter: { bpchar4: { similarTo: "%(TE|ST)%" } }) {
101101
...nodes
102102
}
103-
startsWith: allFilterables(filter: { bpchar4: { startsWith: "t" } }) {
103+
startsWith: allFilterables(filter: { bpchar4: { startsWith: "T" } }) {
104104
...nodes
105105
}
106106
startsWithInsensitive: allFilterables(
107-
filter: { bpchar4: { startsWithInsensitive: "t" } }
107+
filter: { bpchar4: { startsWithInsensitive: "T" } }
108108
) {
109109
...nodes
110110
}

0 commit comments

Comments
 (0)