summaryrefslogtreecommitdiff
path: root/internal/db/bundb/search_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-12-10 14:15:41 +0100
committerLibravatar GitHub <noreply@github.com>2023-12-10 14:15:41 +0100
commit3f070a442a5ffdd771a4937fe079d95672fa3e3f (patch)
treef6412bb7497d2e3d6cbe39021838adb2d00a8edf /internal/db/bundb/search_test.go
parent[bugfix] Ensure `pre` renders as expected, fix orderedCollectionPage (#2434) (diff)
downloadgotosocial-3f070a442a5ffdd771a4937fe079d95672fa3e3f.tar.xz
[bugfix] Narrow search scope for accounts starting with '@'; don't LOWER SQLite text searches (#2435)
Diffstat (limited to 'internal/db/bundb/search_test.go')
-rw-r--r--internal/db/bundb/search_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/db/bundb/search_test.go b/internal/db/bundb/search_test.go
index f84704df2..bc791271e 100644
--- a/internal/db/bundb/search_test.go
+++ b/internal/db/bundb/search_test.go
@@ -37,6 +37,24 @@ func (suite *SearchTestSuite) TestSearchAccountsTurtleAny() {
suite.Len(accounts, 1)
}
+func (suite *SearchTestSuite) TestSearchAccounts1HappyWithPrefix() {
+ testAccount := suite.testAccounts["local_account_1"]
+
+ // Query will just look for usernames that start with "1happy".
+ accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "@1happy", "", "", 10, false, 0)
+ suite.NoError(err)
+ suite.Len(accounts, 1)
+}
+
+func (suite *SearchTestSuite) TestSearchAccounts1HappyNoPrefix() {
+ testAccount := suite.testAccounts["local_account_1"]
+
+ // Query will do the full coalesce.
+ accounts, err := suite.db.SearchForAccounts(context.Background(), testAccount.ID, "1happy", "", "", 10, false, 0)
+ suite.NoError(err)
+ suite.Len(accounts, 1)
+}
+
func (suite *SearchTestSuite) TestSearchAccountsTurtleFollowing() {
testAccount := suite.testAccounts["local_account_1"]