✅ (engine) add rankings test
This commit is contained in:
parent
ac19333fbe
commit
1b1917e67a
1 changed files with 18 additions and 0 deletions
18
engine/src/rankings.spec.ts
Normal file
18
engine/src/rankings.spec.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { expect } from 'chai';
|
||||
import { rankings } from '../wrapper';
|
||||
import { GameState } from './gamestate';
|
||||
|
||||
describe('rankings', () => {
|
||||
it('should rank players correctly', () => {
|
||||
const players: any[] = [
|
||||
{ id: 0, citiesPowered: 20, money: 30, cities: { length: 21 } },
|
||||
{ id: 1, citiesPowered: 20, money: 20, cities: { length: 21 } },
|
||||
{ id: 2, citiesPowered: 20, money: 30, cities: { length: 21 } },
|
||||
{ id: 4, citiesPowered: 18, money: 30, cities: { length: 21 } },
|
||||
{ id: 3, citiesPowered: 18, money: 30, cities: { length: 20 } },
|
||||
{ id: 5, citiesPowered: 19, money: 30, cities: { length: 21 } },
|
||||
];
|
||||
|
||||
expect(rankings({ players } as GameState)).to.have.ordered.members([1, 3, 1, 5, 6, 4]);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue