You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1020 B
27 lines
1020 B
import { it, expect } from 'vitest';
|
|
import { oca } from '../server/games/oca.mjs';
|
|
import { ocaCell, ocaBoard } from '../shared/oca-board.mjs';
|
|
it('la información de peligros y premios corresponde a la acción real', () => {
|
|
for (const [cell, skips] of [
|
|
[19, 1],
|
|
[31, 3],
|
|
[52, 2],
|
|
]) {
|
|
const state = oca.create(2);
|
|
state.positions[0] = cell - 1;
|
|
const next = oca.apply(state, { type: 'roll' }, 0, () => 1).state;
|
|
expect(next.skips[0]).toBe(skips);
|
|
expect(ocaCell(cell).kind).toBe('danger');
|
|
}
|
|
const state = oca.create(2);
|
|
state.positions[0] = 4;
|
|
const next = oca.apply(state, { type: 'roll' }, 0, () => 1).state;
|
|
expect(next.positions[0]).toBe(9);
|
|
expect(next.turn).toBe(0);
|
|
expect(ocaCell(5).description).toContain('9');
|
|
expect(ocaCell(5).kind).toBe('advantage');
|
|
expect(ocaBoard.centers).toHaveLength(64);
|
|
expect(new Set(ocaBoard.centers.map((p) => p.join(','))).size).toBe(64);
|
|
expect(ocaBoard.centers[63][0]).toBeGreaterThan(ocaBoard.centers[62][0]);
|
|
});
|