Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdigital committed Jan 6, 2024
1 parent 5348d9f commit 9fc7fbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion internal/database/fts/tsquery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ func TestAppQueryToTsquery(t *testing.T) {
{"1 word", "foo", "foo"},
{"2 words", "foo bar", "foo & bar"},
{"3 words", "foo bar baz", "foo & bar & baz"},
{"quoted", `"foo bar"`, "foo <-> bar"},
{"operators", "\"make me a\" . (sandwich | panini) !cheese", "make <-> me <-> a <-> (sandwich | panini) & ! cheese"},
{"Ukrainian", "зроби мені бутерброд", "zrobi & meni & buterbrod"},
{"Chinese", "给我做一个三明治", "Gei <-> Wo <-> Zuo <-> Yi <-> Ge <-> San <-> Ming <-> Zhi"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
4 changes: 1 addition & 3 deletions internal/database/fts/tsvector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ import (

func TestParseTsvector(t *testing.T) {
tests := []struct {
name string
input string
wantTsv Tsvector
wantStr string
}{
{
name: "happy path",
input: " 'a':1A bb:2b 'cc ccc':3C 'dD''Dd''':4D e a bb:5 ",
wantTsv: Tsvector{
"a": {
Expand All @@ -35,7 +33,7 @@ func TestParseTsvector(t *testing.T) {
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
t.Run(test.input, func(t *testing.T) {
got, err := ParseTsvector(test.input)
if err != nil {
t.Errorf("ParseTsvector(%q) = %v", test.input, err)
Expand Down

0 comments on commit 9fc7fbb

Please sign in to comment.