mirror of
https://github.com/miniflux/v2.git
synced 2025-08-06 17:41:00 +00:00
refactor(template): remove unused functions and reduce the complexity of truncate
function
- Remove unused functions like hasKey, domain, hasPrefix and contains. - Lower the complexity of truncate from O(n) to O(1).
This commit is contained in:
parent
d80fb242db
commit
1825320369
2 changed files with 3 additions and 29 deletions
|
@ -43,18 +43,6 @@ func TestDictWithInvalidMap(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestHasKey(t *testing.T) {
|
||||
input := map[string]string{"k": "v"}
|
||||
|
||||
if !hasKey(input, "k") {
|
||||
t.Fatal(`This key exists in the map and should returns true`)
|
||||
}
|
||||
|
||||
if hasKey(input, "missing") {
|
||||
t.Fatal(`This key doesn't exists in the given map and should returns false`)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTruncateWithShortTexts(t *testing.T) {
|
||||
scenarios := []string{"Short text", "Короткий текст"}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue