Phase 3: move service layer, serializers and DTOs into WarpEngine + dummy-app test suite
- all catalog services (update/software/highlighted/builds/file/file-manager/ download/image + SoftwareResponseBuilder), the SoftwareUpdater platform services and their concerns, Blueprinter serializers (incl. TimestampFields) and the 4 DTOs now live in the engine under WarpEngine:: - constantize dispatch strings use absolute names (WarpEngine::SoftwareUpdater::<Platform>Service) - container paths read from WarpEngine.config everywhere (FileService, DownloadService, FileManagerService, ArchiveExtraction, ReleaseSerializer path rewriting); FileManagerService base path is now lazy - engine requires blueprinter itself; gemspec declares blueprinter + rubyzip - engine test suite: spec/dummy app (mysql warp_engine_test, catalog-only schema), rails_helper with engine-local factories; catalog model/service specs and factories moved from the host - host suite keeps TTG specs and loads catalog factories from the engine Verified: engine suite 40 green, host suite 14 green, /api/software and /api/builds byte-identical to baselines, admin OK. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe WarpEngine::BuildsService do
|
||||
describe "#index" do
|
||||
subject(:result) { described_class.new.index }
|
||||
|
||||
it "returns all supported platforms with expected kinds" do
|
||||
expect(result[:platforms]).to have_key("tic80")
|
||||
expect(result[:platforms]["tic80"][:label]).to eq("TIC-80")
|
||||
expect(result[:platforms]["tic80"][:kinds]).to include("cartridge", "html")
|
||||
end
|
||||
|
||||
it "returns c64 with only cartridge" do
|
||||
expect(result[:platforms]["c64"][:kinds]).to eq(["cartridge"])
|
||||
end
|
||||
|
||||
it "returns allKinds matching WarpEngine::ReleaseAsset::KINDS" do
|
||||
expect(result[:allKinds]).to eq(WarpEngine::ReleaseAsset::KINDS)
|
||||
end
|
||||
|
||||
it "includes all supported platforms" do
|
||||
WarpEngine::PlatformLink::SUPPORTED_PLATFORMS.each do |platform|
|
||||
expect(result[:platforms]).to have_key(platform)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#show" do
|
||||
let!(:software) { create(:software, name: "test-game", platform: "love") }
|
||||
let!(:release) { create(:release, software: software, version: "1.0.0") }
|
||||
|
||||
before do
|
||||
WarpEngine::ReleaseAsset.create!(release: release, kind: "html", path: "/test/html")
|
||||
WarpEngine::ReleaseAsset.create!(release: release, kind: "win_x64", path: "/test/win")
|
||||
end
|
||||
|
||||
it "returns expected and actual kinds per release" do
|
||||
result = described_class.new.show("test-game")
|
||||
|
||||
expect(result[:platform]).to eq("love")
|
||||
expect(result[:expected]).to match_array(%w[html win_x64 linux_x64 mac_universal])
|
||||
expect(result[:releases]["1.0.0"][:actual]).to match_array(%w[html win_x64])
|
||||
expect(result[:releases]["1.0.0"][:missing]).to match_array(%w[linux_x64 mac_universal])
|
||||
end
|
||||
|
||||
it "raises RecordNotFound for unknown software" do
|
||||
expect { described_class.new.show("nonexistent") }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user