summaryrefslogtreecommitdiff
path: root/src/simulation/game.test.js
blob: ac65618da1dfd010bbf96a3afa53cecb1c655792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';

import { setup_board } from './game.js';


test("set up boards correctly", () => {
  const _ = { type: 'empty', flags: {} };
  const a = { type: 'empty', flags: { team: 0 } };
  const b = { type: 'empty', flags: { team: 1 } };
  const c = { type: 'empty', flags: { team: 2 } };
  const d = { type: 'empty', flags: { team: 3 } };
  const W = { type: 'immutable', flags: {} };

  expect(setup_board(6)).toEqual([
    [ W, W, W, W, W, W, ],
    [ W, W, a, a, W, W, ],
    [ W, d, _, _, b, W, ],
    [ W, d, _, _, b, W, ],
    [ W, W, c, c, W, W, ],
    [ W, W, W, W, W, W, ],
  ]);
  expect(setup_board(9)).toEqual([
    [ W, W, W, W, W, W, W, W, W, ],
    [ W, W, W, a, a, a, W, W, W, ],
    [ W, W, W, a, a, a, W, W, W, ],
    [ W, d, d, _, _, _, b, b, W, ],
    [ W, d, d, _, _, _, b, b, W, ],
    [ W, d, d, _, _, _, b, b, W, ],
    [ W, W, W, c, c, c, W, W, W, ],
    [ W, W, W, c, c, c, W, W, W, ],
    [ W, W, W, W, W, W, W, W, W, ],
  ]);
});