Skip to content

Commit

Permalink
Fix BattleStream test
Browse files Browse the repository at this point in the history
  • Loading branch information
Zarel committed Jun 19, 2020
1 parent dffd9db commit 51344c6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/server/room-battle.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,17 @@ describe('Simulator abstraction layer features', function () {
'>version a2393dfd2a2da5594148bf99eea514e72b136c2c\n' +
'>start {"formatid":"gen8randombattle","seed":[9619,36790,28450,62465],"rated":"Rated battle"}\n' +
'>player p1 {"name":"p1","avatar":"ethan","team":"","rating":1507,"seed":[59512,58581,51338,7861]}\n' +
'>player p2 {"name":"p2","avatar":"dawn","team":"","rating":1447,"seed":[33758,53485,62378,29757]}\n' +
'>player p2 {"name":"p2","avatar":"dawn","team":"","rating":1447,"seed":[33758,53485,62378,29757]}\n'
);
assert((await stream.read()).startsWith('sideupdate\np1\n|request|'));
assert((await stream.read()).startsWith('sideupdate\np2\n|request|'));
assert((await stream.read()).includes('|switch|'));
stream.write(
'>p1 move 1\n' +
'>p2 move 1\n'
);
assert((await stream.read()).startsWith('sideupdate\np1\n|request|'));
assert((await stream.read()).startsWith('sideupdate\np2\n|request|'));
assert((await stream.read()).includes('|move|'));
stream.destroy();
assert.equal(PM.processes[0].load, 0);
Expand All @@ -67,7 +74,7 @@ describe('Simulator abstraction layer features', function () {
'>p1 move 1\n' +
'>p2 move 1\n'
);
assert((await stream2.read()).includes('|move|'));
assert(await stream2.read());
stream2.writeEnd();
await stream2.readAll();
assert.equal(PM.processes[0].load, 0);
Expand Down

0 comments on commit 51344c6

Please sign in to comment.