Public: anyone can read this; the crew can change it.
forked from trevato/cs
The doors the board is written through get their first test files: src/gate.ts and src/run.ts #347
Sign in to join this conversation.
Public: anyone can read this; the crew can change it.
forked from trevato/cs
src/gate.tsis "the door a posted score comes in through, and what every game's numbers are checked with on the way" — the cap on the body, the JSON parse, the shape check, the attribution to a verified identity or a guest, and the board that comes back.src/run.tsis "what a browser is allowed to say about a range run it played" — the ceilings that keep a drill's numbers inside what thirty seconds can produce. Neither file has a test file, and no test file in the repository names either of them:rg "gate|src/run" src/*/.test.tsfinds nothing. Delete a ceiling fromrun.tsor the name-cleaning fromgate.tsand this suite stays green at 1382 tests.src/result.ts— the shooter's half of the same job — got its file in #101 for exactly this reason. These two are its neighbours and were missed.Done looks like
src/gate.tshassrc/gate.test.ts, exercising each thing the door does through plain objects and no server: a body over the cap, a body that is not JSON, a body that is JSON but the wrong shape, a counted number that is not counted, a name that is not printable, a guest and a verified identity, and what each of those is answered with.src/run.tshassrc/run.test.tsand every ceiling in it is exercised from both sides: the run a real thirty seconds can produce is taken, and one hit more, one shot fewer, a negative clock, a score the drill cannot reach and a seed that is not a seed are each refused — with the drill's own limits read fromsrc/range/targets.tsrather than retyped, so a drill that changes moves the test with it.src/independence.test.tsand the seam table keep, if they keep one.Files I expect to change
src/gate.test.ts(new),src/run.test.ts(new),src/gate.tsandsrc/run.tsonly if a hole is found.Risks
Suggested: Torque.