import { describe, expect, it } from 'vitest'; import { createGame } from './state'; import { play } from './test-helpers'; import { tallyOf } from './tally'; describe('the tally of a finished duel', () => { it('counts nothing for a duel still in play', () => { expect(tallyOf(createGame({ A: 'Ann', B: 'Bo' }, 1))).toEqual({}); }); it('counts a surrender as a win by surrender', () => { const s = play(createGame({ A: 'Ann', B: 'Bo' }, 1), { left: 'P', right: 'P' }); expect(s.over?.winner).toBe('B'); expect(tallyOf(s)).toEqual({ "duels won by a rival's surrender": 1, 'wizards who yielded, all told': 1 }); }); });