package main import "testing" func TestChaturbateAutoStartCandidateIndex(t *testing.T) { queue := []autoStartItem{ {userKey: "watched", source: "watched"}, {userKey: "resume", source: "resume", force: true}, } if got := chaturbateAutoStartCandidateIndex(queue, false); got != 0 { t.Fatalf("unpaused candidate index = %d, want 0", got) } if got := chaturbateAutoStartCandidateIndex(queue, true); got != 1 { t.Fatalf("paused candidate index = %d, want forced resume at 1", got) } } func TestChaturbateAutoStartCandidateIndexPausedWithoutResume(t *testing.T) { queue := []autoStartItem{ {userKey: "watched", source: "watched"}, {userKey: "manual", source: "manual"}, } if got := chaturbateAutoStartCandidateIndex(queue, true); got != -1 { t.Fatalf("paused candidate index = %d, want -1", got) } }