fix and test email parsing, add mock matrix
This commit is contained in:
35
main_test.go
Normal file
35
main_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"local/truckstop/config"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseOutStates(t *testing.T) {
|
||||
input := `--0000000000006704ef05d5335639
|
||||
Content-Type: text/plain; charset="UTF-8"
|
||||
|
||||
NC the states should be ok GA SC
|
||||
|
||||
--0000000000006704ef05d5335639
|
||||
Content-Type: text/html; charset="UTF-8"
|
||||
|
||||
<div dir="ltr">NC the states should be ok GA SC<br></div>
|
||||
|
||||
--0000000000006704ef05d5335639--`
|
||||
want := []config.State{
|
||||
config.State("NC"),
|
||||
config.State("OK"),
|
||||
config.State("GA"),
|
||||
config.State("SC"),
|
||||
config.State("NC"),
|
||||
config.State("OK"),
|
||||
config.State("GA"),
|
||||
config.State("SC"),
|
||||
}
|
||||
got := parseOutStates([]byte(input))
|
||||
if fmt.Sprint(want) != fmt.Sprint(got) {
|
||||
t.Fatal(want, got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user