Introduce architettura multi-sport con catalogo, engine scoring e overlay.
Catalogo sport in YAML, board implicito, engine per volley/basket/timed/racket/timer/generic, regia e app Android allineate. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
31
backend/spec/domain/sports/catalog_spec.rb
Normal file
31
backend/spec/domain/sports/catalog_spec.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Sports::Catalog do
|
||||
describe ".find" do
|
||||
it "restituisce pallavolo con board volley" do
|
||||
entry = described_class.find("pallavolo")
|
||||
expect(entry[:board]).to eq("volley")
|
||||
expect(entry[:overlay]).to eq("volley")
|
||||
expect(entry[:default_rules]["sets_to_win"]).to eq(3)
|
||||
end
|
||||
|
||||
it "mappa legacy volleyball" do
|
||||
expect(described_class.normalize_key("volleyball")).to eq("pallavolo")
|
||||
end
|
||||
|
||||
it "altro usa board generic" do
|
||||
entry = described_class.find("altro")
|
||||
expect(entry[:board]).to eq("generic")
|
||||
expect(entry[:overlay]).to eq("none")
|
||||
end
|
||||
end
|
||||
|
||||
describe ".as_api_list" do
|
||||
it "include tutti gli sport configurati" do
|
||||
keys = described_class.as_api_list.map { |e| e[:key] }
|
||||
expect(keys).to include("pallavolo", "basket", "calcio_a_5", "tennis", "ginnastica_artistica", "altro")
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user