mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-09-22 01:04:01 +00:00
Address review on the stubs and controller tests
- The controller tests run against a real Controller, which is side effect free while not started, with real users through its UserManager. The only fakes left are two spies which record broadcasts and permission pushes on their way through. Since any user update also applies auto assignment, the leave event is observed directly rather than through a role change. - raise_event fills in the name and tick of the event the way factorio does, rather than wrapping the payload, and game.players finds players by index as well as by name through a metatable. - names is generic over anything with a name property, so it lives on the suite; the save and load helper no longer calls on_load, the test calls the handler itself as it does for the other handlers. - Sent messages and events are compared whole with deep_eq, which pins the event shape, the tick, and that the unassign key is absent rather than empty. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
7adcdde9dc
commit
e6552a39be
@@ -55,15 +55,6 @@ local function make_env()
|
||||
return (assert(env.Roles.get_role_by_name(name), "No role named " .. name))
|
||||
end
|
||||
|
||||
--- Names of an array of roles
|
||||
function env.names(roles)
|
||||
local rtn = {}
|
||||
for index, role in ipairs(roles) do
|
||||
rtn[index] = role.name
|
||||
end
|
||||
return rtn
|
||||
end
|
||||
|
||||
--- An assignment record as the controller would send it
|
||||
function env.assignment(name, role_ids)
|
||||
return { name = name, role_ids = role_ids }
|
||||
@@ -78,13 +69,6 @@ local function make_env()
|
||||
}
|
||||
end
|
||||
|
||||
--- Save and load the map, as far as the roles module can tell
|
||||
local stub_save_load = env.save_load
|
||||
function env.save_load()
|
||||
stub_save_load()
|
||||
env.Roles.on_load()
|
||||
end
|
||||
|
||||
return env
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user