mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 11:42:07 +00:00
Feature/guest trainer (#89)
* add anonymous guest training with a daily puzzle limit - /guest-train serves random endgames with no difficulty picker; signed-in visitors are redirected to /train - guests get 5 puzzles per UTC day, keyed by an in-memory HMAC of the client address; the raw address is never stored or logged - a sign-up wall replaces the next puzzle once the budget is spent - move the endgame library behind auth so guests cannot browse it - privacy disclosure tracked in #87 * remove chess-test endpoint and liveview
This commit is contained in:
@@ -322,7 +322,7 @@ defmodule Chesstrainer.EndgamesTest do
|
||||
end
|
||||
end
|
||||
|
||||
describe "random_endgame/0" do
|
||||
describe "random_endgame/1" do
|
||||
test "returns nil when there are no endgames" do
|
||||
assert Endgames.random_endgame() == nil
|
||||
end
|
||||
@@ -333,6 +333,13 @@ defmodule Chesstrainer.EndgamesTest do
|
||||
|
||||
assert Endgames.random_endgame().id in [kr.id, kq.id]
|
||||
end
|
||||
|
||||
test "skips excluded endgames" do
|
||||
kr = create_endgame!(@kr)
|
||||
kq = create_endgame!(@kq)
|
||||
|
||||
assert Endgames.random_endgame(exclude_ids: [kr.id]).id == kq.id
|
||||
end
|
||||
end
|
||||
|
||||
describe "curated_endgames/1" do
|
||||
|
||||
Reference in New Issue
Block a user