diff options
author | 2023-12-10 14:15:41 +0100 | |
---|---|---|
committer | 2023-12-10 14:15:41 +0100 | |
commit | 3f070a442a5ffdd771a4937fe079d95672fa3e3f (patch) | |
tree | f6412bb7497d2e3d6cbe39021838adb2d00a8edf /internal/db/bundb/search_test.go | |
parent | [bugfix] Ensure `pre` renders as expected, fix orderedCollectionPage (#2434) (diff) | |
download | gotosocial-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.go | 18 |
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"] |