package extsvc

import "testing"

// TQSL refuses whole records over a MY_CNTY it cannot validate, and its
// validation is the US "XX,County" enumeration — so anything else must be
// stripped before signing, and the US shape must survive untouched.
func TestScrubMyCnty(t *testing.T) {
	cases := []struct{ in, want string }{
		{"<CALL:5>F4BPO<MY_CNTY:16>ONTARIO,Kawartha<MY_STATE:7>ONTARIO<EOR>",
			"<CALL:5>F4BPO<MY_STATE:7>ONTARIO<EOR>"},
		{"<MY_CNTY:8>Kawartha<EOR>", "<EOR>"},
		{"<MY_CNTY:9>NY,Monroe<EOR>", "<MY_CNTY:9>NY,Monroe<EOR>"},
		{"<CALL:4>K1AB<EOR>", "<CALL:4>K1AB<EOR>"},
		{"<MY_CNTY:8>Kawartha<EOR>\n<MY_CNTY:9>NY,Monroe<EOR>",
			"<EOR>\n<MY_CNTY:9>NY,Monroe<EOR>"},
	}
	for _, c := range cases {
		if got := scrubMyCnty(c.in); got != c.want {
			t.Errorf("scrubMyCnty(%q) = %q, want %q", c.in, got, c.want)
		}
	}
}
