The SOTA feeds put the summit in the spot's own text, so there is nothing to poll: a regex on the comment gives the reference, and clicking the spot writes SOTA@<ref> into the award references the way a park already wrote POTA@<ref>. The regex is narrow on purpose — association/region-NNN, anchored — because POTA (US-4475), WWFF (DLFF-0001) and portable callsigns (DL/SP9DPM/P) share that field and none of them is a summit. Pinned by a table test. Off by default: the reference is only there on the summit feeds, and an empty column for every operator who does not chase them is worse than a checkbox.
26 lines
680 B
Go
26 lines
680 B
Go
package cluster
|
|
|
|
import "testing"
|
|
|
|
func TestSOTARefFrom(t *testing.T) {
|
|
// Left column: real comments seen on the SOTA cluster feed.
|
|
cases := []struct{ in, want string }{
|
|
{"W9/WI-001", "W9/WI-001"},
|
|
{"DM/BM-063", "DM/BM-063"},
|
|
{"W7Y/TT-122", "W7Y/TT-122"},
|
|
{"VK3/VC-014 s2s", "VK3/VC-014"},
|
|
{"[SOTA] F/AM-123 cq", "F/AM-123"},
|
|
{"", ""},
|
|
// The other reference schemes that share this field.
|
|
{"POTA US-4475", ""},
|
|
{"WWFF DLFF-0001", ""},
|
|
// A portable callsign is not a summit.
|
|
{"DL/SP9DPM/P calling", ""},
|
|
}
|
|
for _, c := range cases {
|
|
if got := SOTARefFrom(c.in); got != c.want {
|
|
t.Errorf("SOTARefFrom(%q) = %q, want %q", c.in, got, c.want)
|
|
}
|
|
}
|
|
}
|