diff --git a/test/spec/Feature/ExtraSearchPathSpec.hs b/test/spec/Feature/ExtraSearchPathSpec.hs index bebed92c6..0d4a8e27c 100644 --- a/test/spec/Feature/ExtraSearchPathSpec.hs +++ b/test/spec/Feature/ExtraSearchPathSpec.hs @@ -20,6 +20,29 @@ spec = describe "extra search path" $ do {"path":"Top.Science.Astronomy.Cosmology"}]|] { matchHeaders = [matchContentTypeJson] } + it "finds the ltree ~ operator on the public schema" $ do + request methodGet "/ltree_sample?path=match.*.Science" [] "" + `shouldRespondWith` [json|[ + {"path": "Top.Science"}]|] + { matchHeaders = [matchContentTypeJson] } + + request methodGet "/ltree_sample?path=match.*.Astronomy.*" [] "" + `shouldRespondWith` [json|[ + {"path": "Top.Science.Astronomy"}, + {"path": "Top.Science.Astronomy.Astrophysics"}, + {"path": "Top.Science.Astronomy.Cosmology"}, + {"path": "Top.Collections.Pictures.Astronomy"}, + {"path": "Top.Collections.Pictures.Astronomy.Stars"}, + {"path": "Top.Collections.Pictures.Astronomy.Galaxies"}, + {"path": "Top.Collections.Pictures.Astronomy.Astronauts"}]|] + { matchHeaders = [matchContentTypeJson] } + + request methodGet "/ltree_sample?path=match.*.Collections.*{1,2}" [] "" + `shouldRespondWith` [json|[ + {"path": "Top.Collections.Pictures"}, + {"path": "Top.Collections.Pictures.Astronomy"}]|] + { matchHeaders = [matchContentTypeJson] } + it "finds the ltree nlevel function on the public schema, used through a computed column" $ request methodGet "/ltree_sample?select=number_of_labels&path=eq.Top.Science" [] "" `shouldRespondWith` [json|[{"number_of_labels":2}]|] diff --git a/test/spec/fixtures/data.sql b/test/spec/fixtures/data.sql index b5444c299..24bc78a4a 100644 --- a/test/spec/fixtures/data.sql +++ b/test/spec/fixtures/data.sql @@ -543,6 +543,14 @@ INSERT INTO ltree_sample VALUES ('Top.Science'); INSERT INTO ltree_sample VALUES ('Top.Science.Astronomy'); INSERT INTO ltree_sample VALUES ('Top.Science.Astronomy.Astrophysics'); INSERT INTO ltree_sample VALUES ('Top.Science.Astronomy.Cosmology'); +INSERT INTO ltree_sample VALUES ('Top.Hobbies'); +INSERT INTO ltree_sample VALUES ('Top.Hobbies.Amateurs_Astronomy'); +INSERT INTO ltree_sample VALUES ('Top.Collections'); +INSERT INTO ltree_sample VALUES ('Top.Collections.Pictures'); +INSERT INTO ltree_sample VALUES ('Top.Collections.Pictures.Astronomy'); +INSERT INTO ltree_sample VALUES ('Top.Collections.Pictures.Astronomy.Stars'); +INSERT INTO ltree_sample VALUES ('Top.Collections.Pictures.Astronomy.Galaxies'); +INSERT INTO ltree_sample VALUES ('Top.Collections.Pictures.Astronomy.Astronauts'); TRUNCATE TABLE isn_sample CASCADE; INSERT INTO isn_sample VALUES ('978-0-393-04002-9', 'Mathematics: From the Birth of Numbers');