Abstimmung Ja/Nein statt Links/Rechts
Modus-Werte yes/no statt left/right in DB, API und Statistik; Knöpfe "Ja"/"Nein". Bestehende Stimmen müssen per SQL migriert werden. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TiXsPUqw7oeomZ8wZrQW5q
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3d2447fe35
commit
b6cf8c7fa0
+9
-9
@@ -187,8 +187,8 @@ func TestCreateEntryRequiresAuth(t *testing.T) {
|
||||
}
|
||||
|
||||
type tally struct {
|
||||
Left int `json:"left"`
|
||||
Right int `json:"right"`
|
||||
Yes int `json:"yes"`
|
||||
No int `json:"no"`
|
||||
Selected string `json:"selected"`
|
||||
}
|
||||
|
||||
@@ -209,16 +209,16 @@ func TestVoting(t *testing.T) {
|
||||
return tl
|
||||
}
|
||||
|
||||
if got := vote(alice, "left"); got.Left != 1 || got.Selected != "left" {
|
||||
t.Fatalf("alice left: %+v", got)
|
||||
if got := vote(alice, "yes"); got.Yes != 1 || got.Selected != "yes" {
|
||||
t.Fatalf("alice yes: %+v", got)
|
||||
}
|
||||
if got := vote(bob, "right"); got.Left != 1 || got.Right != 1 {
|
||||
t.Fatalf("bob right: %+v", got)
|
||||
if got := vote(bob, "no"); got.Yes != 1 || got.No != 1 {
|
||||
t.Fatalf("bob no: %+v", got)
|
||||
}
|
||||
if got := vote(alice, "left"); got.Left != 0 || got.Selected != "none" {
|
||||
if got := vote(alice, "yes"); got.Yes != 0 || got.Selected != "none" {
|
||||
t.Fatalf("alice toggle off: %+v", got)
|
||||
}
|
||||
if got := vote(alice, "right"); got.Right != 2 || got.Selected != "right" {
|
||||
if got := vote(alice, "no"); got.No != 2 || got.Selected != "no" {
|
||||
t.Fatalf("alice switch: %+v", got)
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ func TestVoteRequiresAuthAndValidMode(t *testing.T) {
|
||||
voteURL := fmt.Sprintf("%s/api/entry/%d/vote", srv.URL, pid)
|
||||
|
||||
anon := newClient(t)
|
||||
resp := postForm(t, anon, voteURL, url.Values{"mode": {"left"}})
|
||||
resp := postForm(t, anon, voteURL, url.Values{"mode": {"yes"}})
|
||||
resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusUnauthorized {
|
||||
t.Fatalf("anon vote: erwartet 401, bekam %d", resp.StatusCode)
|
||||
|
||||
Reference in New Issue
Block a user