mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
27 lines
1.4 KiB
GDScript
27 lines
1.4 KiB
GDScript
extends "res://tests/test_case.gd"
|
|
|
|
const EnetTransport = preload("res://scripts/enet_transport.gd")
|
|
const SteamBootstrap = preload("res://scripts/steam_bootstrap.gd")
|
|
const SteamTransport = preload("res://scripts/steam_transport.gd")
|
|
|
|
func test_enet_is_available_without_steam() -> void:
|
|
var transport = EnetTransport.new()
|
|
assert_true(transport.is_available(), "ENet remains available in a stock Godot build")
|
|
assert_eq(transport.transport_id(), "enet", "stable selection key")
|
|
|
|
|
|
func test_steam_development_app_id_has_a_safe_default() -> void:
|
|
assert_eq(SteamBootstrap.app_id(), SteamBootstrap.SPACEWAR_APP_ID, "Spacewar is the local-development default")
|
|
assert_true(SteamBootstrap.app_id() > 0, "Steam bootstrap never uses an invalid app ID")
|
|
|
|
|
|
func test_stock_build_refuses_steam_without_falling_back_to_enet() -> void:
|
|
var transport = SteamTransport.new()
|
|
if transport.is_available():
|
|
assert_true(true, "a custom Steam build is validated by the separate Steam export check")
|
|
return
|
|
var result: Dictionary = transport.create_server(7777, 2)
|
|
assert_eq(int(result.error), ERR_UNAVAILABLE, "Steam request fails explicitly when its custom build is absent")
|
|
assert_true(not result.has("peer") or result.peer == null, "an unavailable Steam request never returns an ENet peer")
|
|
assert_true(not transport.unavailable_reason().is_empty(), "failure tells an operator what is missing")
|