MM-31063: Change constants to use CamelCase (#16608)

* MM-31063: Change constants to use CamelCase

* store package

* change allcaps to camel case (#16615)

* New tools.mod

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
Agniva De Sarker
2021-01-04 11:32:29 +05:30
коммит произвёл GitHub
родитель 8b6ac5f5d2
Коммит c1dd23a3c8
158 изменённых файлов: 1485 добавлений и 1479 удалений

Просмотреть файл

@@ -15,52 +15,52 @@ var searchChannelStoreTests = []searchTest{
{
Name: "Should be able to autocomplete a channel by name",
Fn: testAutocompleteChannelByName,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to autocomplete a channel by display name",
Fn: testAutocompleteChannelByDisplayName,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to autocomplete a channel by a part of its name when has parts splitted by - character",
Fn: testAutocompleteChannelByNameSplittedWithDashChar,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to autocomplete a channel by a part of its name when has parts splitted by _ character",
Fn: testAutocompleteChannelByNameSplittedWithUnderscoreChar,
Tags: []string{ENGINE_MYSQL, ENGINE_ELASTICSEARCH, ENGINE_BLEVE},
Tags: []string{EngineMySql, EngineElasticSearch, EngineBleve},
},
{
Name: "Should be able to autocomplete a channel by a part of its display name when has parts splitted by whitespace character",
Fn: testAutocompleteChannelByDisplayNameSplittedByWhitespaces,
Tags: []string{ENGINE_MYSQL, ENGINE_ELASTICSEARCH, ENGINE_BLEVE},
Tags: []string{EngineMySql, EngineElasticSearch, EngineBleve},
},
{
Name: "Should be able to autocomplete retrieving all channels if the term is empty",
Fn: testAutocompleteAllChannelsIfTermIsEmpty,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to autocomplete channels in a case insensitive manner",
Fn: testSearchChannelsInCaseInsensitiveManner,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should autocomplete only returning public channels",
Fn: testSearchOnlyPublicChannels,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support to autocomplete having a hyphen as the last character",
Fn: testSearchShouldSupportHavingHyphenAsLastCharacter,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support to autocomplete with archived channels",
Fn: testSearchShouldSupportAutocompleteWithArchivedChannels,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
}

Просмотреть файл

@@ -16,250 +16,250 @@ var searchPostStoreTests = []searchTest{
{
Name: "Should be able to search posts including results from DMs",
Fn: testSearchPostsIncludingDMs,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search posts using pagination",
Fn: testSearchPostsWithPagination,
Tags: []string{ENGINE_ELASTICSEARCH, ENGINE_BLEVE},
Tags: []string{EngineElasticSearch, EngineBleve},
},
{
Name: "Should return pinned and unpinned posts",
Fn: testSearchReturnPinnedAndUnpinned,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search for exact phrases in quotes",
Fn: testSearchExactPhraseInQuotes,
Tags: []string{ENGINE_POSTGRES, ENGINE_MYSQL, ENGINE_ELASTICSEARCH},
Tags: []string{EnginePostgres, EngineMySql, EngineElasticSearch},
},
{
Name: "Should be able to search for email addresses with or without quotes",
Fn: testSearchEmailAddresses,
Tags: []string{ENGINE_ELASTICSEARCH},
Tags: []string{EngineElasticSearch},
},
{
Name: "Should be able to search when markdown underscores are applied",
Fn: testSearchMarkdownUnderscores,
Tags: []string{ENGINE_POSTGRES, ENGINE_ELASTICSEARCH},
Tags: []string{EnginePostgres, EngineElasticSearch},
},
{
Name: "Should be able to search for non-latin words",
Fn: testSearchNonLatinWords,
Tags: []string{ENGINE_ELASTICSEARCH},
Tags: []string{EngineElasticSearch},
},
{
Name: "Should be able to search for alternative spellings of words",
Fn: testSearchAlternativeSpellings,
Tags: []string{ENGINE_ELASTICSEARCH},
Tags: []string{EngineElasticSearch},
},
{
Name: "Should be able to search for alternative spellings of words with and without accents",
Fn: testSearchAlternativeSpellingsAccents,
Tags: []string{ENGINE_ELASTICSEARCH},
Tags: []string{EngineElasticSearch},
},
{
Name: "Should be able to search or exclude messages written by a specific user",
Fn: testSearchOrExcludePostsBySpecificUser,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search or exclude messages written in a specific channel",
Fn: testSearchOrExcludePostsInChannel,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search or exclude messages written in a DM or GM",
Fn: testSearchOrExcludePostsInDMGM,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to filter messages written after a specific date",
Fn: testFilterMessagesAfterSpecificDate,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to filter messages written before a specific date",
Fn: testFilterMessagesBeforeSpecificDate,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to filter messages written on a specific date",
Fn: testFilterMessagesInSpecificDate,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to exclude messages that contain a serch term",
Fn: testFilterMessagesWithATerm,
Tags: []string{ENGINE_MYSQL, ENGINE_POSTGRES},
Tags: []string{EngineMySql, EnginePostgres},
},
{
Name: "Should be able to search using boolean operators",
Fn: testSearchUsingBooleanOperators,
Tags: []string{ENGINE_MYSQL, ENGINE_POSTGRES, ENGINE_ELASTICSEARCH},
Tags: []string{EngineMySql, EnginePostgres, EngineElasticSearch},
},
{
Name: "Should be able to search with combined filters",
Fn: testSearchUsingCombinedFilters,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to ignore stop words",
Fn: testSearchIgnoringStopWords,
Tags: []string{ENGINE_MYSQL, ENGINE_ELASTICSEARCH},
Tags: []string{EngineMySql, EngineElasticSearch},
},
{
Name: "Should support search stemming",
Fn: testSupportStemming,
Tags: []string{ENGINE_POSTGRES, ENGINE_ELASTICSEARCH},
Tags: []string{EnginePostgres, EngineElasticSearch},
},
{
Name: "Should support search with wildcards",
Fn: testSupportWildcards,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should not support search with preceding wildcards",
Fn: testNotSupportPrecedingWildcards,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should discard a wildcard if it's not placed immediately by text",
Fn: testSearchDiscardWildcardAlone,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support terms with dash",
Fn: testSupportTermsWithDash,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
Skip: true,
},
{
Name: "Should support terms with underscore",
Fn: testSupportTermsWithUnderscore,
Tags: []string{ENGINE_MYSQL, ENGINE_ELASTICSEARCH},
Tags: []string{EngineMySql, EngineElasticSearch},
},
{
Name: "Should search or exclude post using hashtags",
Fn: testSearchOrExcludePostsWithHashtags,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support searching for hashtags surrounded by markdown",
Fn: testSearchHashtagWithMarkdown,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support searching for multiple hashtags",
Fn: testSearcWithMultipleHashtags,
Tags: []string{ENGINE_ELASTICSEARCH},
Tags: []string{EngineElasticSearch},
},
{
Name: "Should support searching hashtags with dots",
Fn: testSearchPostsWithDotsInHashtags,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search or exclude messages with hashtags in a case insensitive manner",
Fn: testSearchHashtagCaseInsensitive,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search by hashtags with dashes",
Fn: testSearchHashtagWithDash,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search by hashtags with numbers",
Fn: testSearchHashtagWithNumbers,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search by hashtags with dots",
Fn: testSearchHashtagWithDots,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search by hashtags with underscores",
Fn: testSearchHashtagWithUnderscores,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should not return system messages",
Fn: testSearchShouldExcludeSytemMessages,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search matching by mentions",
Fn: testSearchShouldBeAbleToMatchByMentions,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search in deleted/archived channels",
Fn: testSearchInDeletedOrArchivedChannels,
Tags: []string{ENGINE_MYSQL, ENGINE_POSTGRES},
Tags: []string{EngineMySql, EnginePostgres},
},
{
Name: "Should be able to search terms with dashes",
Fn: testSearchTermsWithDashes,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
Skip: true,
SkipMessage: "Not working",
},
{
Name: "Should be able to search terms with dots",
Fn: testSearchTermsWithDots,
Tags: []string{ENGINE_POSTGRES, ENGINE_ELASTICSEARCH},
Tags: []string{EnginePostgres, EngineElasticSearch},
},
{
Name: "Should be able to search terms with underscores",
Fn: testSearchTermsWithUnderscores,
Tags: []string{ENGINE_MYSQL, ENGINE_ELASTICSEARCH},
Tags: []string{EngineMySql, EngineElasticSearch},
},
{
Name: "Should be able to search posts made by bot accounts",
Fn: testSearchBotAccountsPosts,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to combine stemming and wildcards",
Fn: testSupportStemmingAndWildcards,
Tags: []string{ENGINE_ELASTICSEARCH},
Tags: []string{EngineElasticSearch},
},
{
Name: "Should support wildcard outside quotes",
Fn: testSupportWildcardOutsideQuotes,
Tags: []string{ENGINE_ELASTICSEARCH},
Tags: []string{EngineElasticSearch},
},
{
Name: "Should support hashtags with 3 or more characters",
Fn: testHashtagSearchShouldSupportThreeOrMoreCharacters,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should not support slash as character separator",
Fn: testSlashShouldNotBeCharSeparator,
Tags: []string{ENGINE_MYSQL, ENGINE_ELASTICSEARCH},
Tags: []string{EngineMySql, EngineElasticSearch},
},
{
Name: "Should be able to search emails without quoting them",
Fn: testSearchEmailsWithoutQuotes,
Tags: []string{ENGINE_ELASTICSEARCH},
Tags: []string{EngineElasticSearch},
},
{
Name: "Should be able to search in comments",
Fn: testSupportSearchInComments,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search terms within links",
Fn: testSupportSearchTermsWithinLinks,
Tags: []string{ENGINE_MYSQL, ENGINE_ELASTICSEARCH},
Tags: []string{EngineMySql, EngineElasticSearch},
},
{
Name: "Should not return links that are embedded in markdown",
Fn: testShouldNotReturnLinksEmbeddedInMarkdown,
Tags: []string{ENGINE_POSTGRES, ENGINE_ELASTICSEARCH},
Tags: []string{EnginePostgres, EngineElasticSearch},
},
}

Просмотреть файл

@@ -11,11 +11,11 @@ import (
)
const (
ENGINE_ALL = "all"
ENGINE_MYSQL = "mysql"
ENGINE_POSTGRES = "postgres"
ENGINE_ELASTICSEARCH = "elasticsearch"
ENGINE_BLEVE = "bleve"
EngineAll = "all"
EngineMySql = "mysql"
EnginePostgres = "postgres"
EngineElasticSearch = "elasticsearch"
EngineBleve = "bleve"
)
type SearchTestEngine struct {
@@ -35,7 +35,7 @@ type searchTest struct {
func filterTestsByTag(tests []searchTest, tags ...string) []searchTest {
filteredTests := []searchTest{}
for _, test := range tests {
if utils.StringInSlice(ENGINE_ALL, test.Tags) {
if utils.StringInSlice(EngineAll, test.Tags) {
filteredTests = append(filteredTests, test)
continue
}

Просмотреть файл

@@ -15,141 +15,141 @@ var searchUserStoreTests = []searchTest{
{
Name: "Should retrieve all users in a channel if the search term is empty",
Fn: testGetAllUsersInChannelWithEmptyTerm,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should honor channel restrictions when autocompleting users",
Fn: testHonorChannelRestrictionsAutocompletingUsers,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should honor team restrictions when autocompleting users",
Fn: testHonorTeamRestrictionsAutocompletingUsers,
Tags: []string{ENGINE_ELASTICSEARCH, ENGINE_BLEVE},
Tags: []string{EngineElasticSearch, EngineBleve},
},
{
Name: "Should return nothing if the user can't access the channels of a given search",
Fn: testShouldReturnNothingWithoutProperAccess,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
Skip: true,
SkipMessage: "Failing when the ListOfAllowedChannels property is empty",
},
{
Name: "Should autocomplete for user using username",
Fn: testAutocompleteUserByUsername,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should autocomplete user searching by first name",
Fn: testAutocompleteUserByFirstName,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should autocomplete user searching by last name",
Fn: testAutocompleteUserByLastName,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should autocomplete for user using nickname",
Fn: testAutocompleteUserByNickName,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should autocomplete for user using email",
Fn: testAutocompleteUserByEmail,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
Skip: true,
SkipMessage: "Failing for multiple different reasons in the engines",
},
{
Name: "Should be able not to match specific queries with mail",
Fn: testShouldNotMatchSpecificQueriesEmail,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to autocomplete a user by part of its username splitted by Dot",
Fn: testAutocompleteUserByUsernameWithDot,
Tags: []string{ENGINE_ELASTICSEARCH, ENGINE_BLEVE},
Tags: []string{EngineElasticSearch, EngineBleve},
},
{
Name: "Should be able to autocomplete a user by part of its username splitted by underscore",
Fn: testAutocompleteUserByUsernameWithUnderscore,
Tags: []string{ENGINE_ELASTICSEARCH, ENGINE_BLEVE},
Tags: []string{EngineElasticSearch, EngineBleve},
},
{
Name: "Should be able to autocomplete a user by part of its username splitted by hyphen",
Fn: testAutocompleteUserByUsernameWithHyphen,
Tags: []string{ENGINE_ELASTICSEARCH, ENGINE_BLEVE},
Tags: []string{EngineElasticSearch, EngineBleve},
},
{
Name: "Should escape the percentage character",
Fn: testShouldEscapePercentageCharacter,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should escape the dash character",
Fn: testShouldEscapeUnderscoreCharacter,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should be able to search inactive users",
Fn: testShouldBeAbleToSearchInactiveUsers,
Tags: []string{ENGINE_MYSQL, ENGINE_POSTGRES, ENGINE_ELASTICSEARCH},
Tags: []string{EngineMySql, EnginePostgres, EngineElasticSearch},
},
{
Name: "Should be able to search filtering by role",
Fn: testShouldBeAbleToSearchFilteringByRole,
Tags: []string{ENGINE_MYSQL, ENGINE_POSTGRES, ENGINE_ELASTICSEARCH},
Tags: []string{EngineMySql, EnginePostgres, EngineElasticSearch},
},
{
Name: "Should ignore leading @ when searching users",
Fn: testShouldIgnoreLeadingAtSymbols,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should search users in a case insensitive manner",
Fn: testSearchUsersShouldBeCaseInsensitive,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support one or two character usernames and first/last names in search",
Fn: testSearchOneTwoCharUsersnameAndFirstLastNames,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support Korean characters",
Fn: testShouldSupportKoreanCharacters,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support search with a hyphen at the end of the term",
Fn: testSearchWithHyphenAtTheEndOfTheTerm,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support search all users in a team",
Fn: testSearchUsersInTeam,
Tags: []string{ENGINE_ELASTICSEARCH},
Tags: []string{EngineElasticSearch},
},
{
Name: "Should support search users by full name",
Fn: testSearchUsersByFullName,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support search all users in a team with username containing a dot",
Fn: testSearchUsersInTeamUsernameWithDot,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support search all users in a team with username containing a hyphen",
Fn: testSearchUsersInTeamUsernameWithHyphen,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
{
Name: "Should support search all users in a team with username containing a underscore",
Fn: testSearchUsersInTeamUsernameWithUnderscore,
Tags: []string{ENGINE_ALL},
Tags: []string{EngineAll},
},
}