virtualcommons / port-of-mars

Port of Mars is an online, game-based, social science experiment set on the first human community on the Red Planet. We are now in an open beta where anyone aged 18 and over can participate.
https://portofmars.asu.edu
GNU Affero General Public License v3.0
10 stars 16 forks source link

data verification / validation #840

Open alee opened 1 year ago

alee commented 1 year ago

tests

increase test coverage in replay.test.ts to ensure that in-game actions are persisted properly

  1. include full coverage for in-game actions + activities: investment, trade, accomplishment purchase, discard, events
  2. use the persisted RoundSummary TakenStateSnapshot game events to sanity check that everything recorded is at it should be

@sgfost has a good suggestion to take an existing game playthrough and convert it into a data fixture that can be loaded into the test database and then we make assertions against that canned game

CLI validation

create a general CLI validate game command that takes a game id or game ids and validates the game state for that game. This validate function could potentially be put into the GameReplayer class in services/replay.ts and be used in by the test above

sgfost commented 1 year ago

validate command implemented in 8fb9d3a1d7083c1b7e945940b0706d5af96408aa

checks against the following data points:

sgfost commented 1 year ago

take an existing game playthrough and convert it into a data fixture that can be loaded into the test database and then we make assertions against that canned game

Doesn't make a ton of sense on second thought, since we want to be testing how the persistence of the game events reacts to changes as well as the simulation. Best to just define a more thorough stream of events

sgfost commented 1 year ago

30df3a0ad25b39c8232203da3c8f7646d948e1cf increases coverage in the replay test. Its not too elegant, it mostly just extends the existing strategy of speccing out an event stream, replaying and making assertions against the simulation, but should reasonably cover potential breaking changes.