fix and test email parsing, add mock matrix

This commit is contained in:
Bel LaPointe
2022-01-11 00:02:00 -05:00
parent ec2b514a9f
commit 392578bb54
6 changed files with 72 additions and 13 deletions

35
main_test.go Normal file
View 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)
}
}