Add character emotes across bot friend and ranked matches
This commit is contained in:
@@ -32,6 +32,24 @@ class Wire {
|
||||
close() { this.connected = false; }
|
||||
disconnect() { this.connected = false; for (const h of this.states) h('disconnected'); }
|
||||
}
|
||||
test('peer emotes reach the correct slot without exposing choices or changing the turn', async () => {
|
||||
const h = setup(), [a, b] = h.controllers;
|
||||
try {
|
||||
await Promise.all(h.controllers.map(c => c.start())); await h.clock.advance(4000);
|
||||
await a.submitAction('charge'); await h.clock.advance(1);
|
||||
const before = b.view();
|
||||
assert.equal(a.sendEmote('greet'), true);
|
||||
assert.equal(a.sendEmote('taunt'), false);
|
||||
await h.clock.advance(1);
|
||||
assert.equal(b.view().emotes?.[0]?.id, 'greet');
|
||||
assert.equal(b.view().ownAction, null);
|
||||
assert.equal(b.view().turnId, before.turnId);
|
||||
assert.deepEqual(b.view().energy, before.energy);
|
||||
assert.equal(b.view().phase, 'selecting');
|
||||
await b.leave();
|
||||
assert.equal(b.sendEmote('threaten'), false);
|
||||
} finally { h.close(); }
|
||||
});
|
||||
function setup(onRematch?: () => Promise<void>, guestClockOffset = 0, guestStartDelay = 0) {
|
||||
const clock = new ManualClock(); clock.time = 1000;
|
||||
const a = new Wire(), b = new Wire(); a.remote = b; b.remote = a;
|
||||
|
||||
Reference in New Issue
Block a user