44 lines
869 B
Go
44 lines
869 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"gogs.inhome.blapointe.com/local/truckstop/config"
|
|
"os"
|
|
"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)
|
|
}
|
|
}
|
|
|
|
func TestMain(t *testing.T) {
|
|
os.Setenv("CONFIG", "./config.main_test.json")
|
|
if err := _main(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|