frontend: add tests against XSS
This commit is contained in:
30
frontend/dn42_test.go
Normal file
30
frontend/dn42_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDN42WhoisFilter(t *testing.T) {
|
||||
input := "name: Testing\ndescr: Description"
|
||||
|
||||
result := dn42WhoisFilter(input)
|
||||
|
||||
expectedResult := `name: Testing
|
||||
|
||||
1 line(s) skipped.
|
||||
`
|
||||
|
||||
if result != expectedResult {
|
||||
t.Errorf("Output doesn't match expected: %s", result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDN42WhoisFilterUnneeded(t *testing.T) {
|
||||
input := "name: Testing\nwhatever: Description"
|
||||
|
||||
result := dn42WhoisFilter(input)
|
||||
|
||||
if result != input+"\n" {
|
||||
t.Errorf("Output doesn't match expected: %s", result)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user