From 51344c6d3f8ffbadc51ad691a086fb94693141fb Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Thu, 18 Jun 2020 22:39:17 -0700 Subject: [PATCH] Fix BattleStream test --- test/server/room-battle.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/server/room-battle.js b/test/server/room-battle.js index 44ed4a74d03c..6cb6ded64f22 100644 --- a/test/server/room-battle.js +++ b/test/server/room-battle.js @@ -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); @@ -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);