general: add unit tests for >80% coverage
Includes a few minor fixes: - frontend: support setting port for WHOIS server - proxy: fix handling of very long lines - proxy: refactor IP allowlist logic, parse allow IP list at startup
This commit is contained in:
25
frontend/template_test.go
Normal file
25
frontend/template_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/magiconair/properties/assert"
|
||||
)
|
||||
|
||||
func TestSummaryRowDataNameHasPrefix(t *testing.T) {
|
||||
data := SummaryRowData{
|
||||
Name: "mock",
|
||||
}
|
||||
|
||||
assert.Equal(t, data.NameHasPrefix("m"), true)
|
||||
assert.Equal(t, data.NameHasPrefix("n"), false)
|
||||
}
|
||||
|
||||
func TestSummaryRowDataNameContains(t *testing.T) {
|
||||
data := SummaryRowData{
|
||||
Name: "mock",
|
||||
}
|
||||
|
||||
assert.Equal(t, data.NameContains("oc"), true)
|
||||
assert.Equal(t, data.NameContains("no"), false)
|
||||
}
|
||||
Reference in New Issue
Block a user