diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-03-14 20:52:08 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-03-14 20:52:08 +0300 |
commit | d64c44c432ccb5574909edd77b8b882e8543ef1b (patch) | |
tree | feb4035bf7301f9b627634695b7650027e5eecc4 /src/Tile/TileOnBoard.test.ts | |
parent | 9cf681ff497150e4d56b13bde4f57f4f0e9633c0 (diff) | |
download | carcassonne-engine-ts-d64c44c432ccb5574909edd77b8b882e8543ef1b.tar.gz |
refactor!: change internal edge representation
Diffstat (limited to 'src/Tile/TileOnBoard.test.ts')
-rw-r--r-- | src/Tile/TileOnBoard.test.ts | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/Tile/TileOnBoard.test.ts b/src/Tile/TileOnBoard.test.ts deleted file mode 100644 index de2685d..0000000 --- a/src/Tile/TileOnBoard.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import assert from 'assert'; -import TileOnBoard from './TileOnBoard'; -import { Direction, Feature } from './Tile'; - -const { North, East, South, West } = Direction; -const { Road, Town, Grass, River } = Feature; - -describe('TileOnBoard', () => { - describe('getSide', () => { - it('Should get North, East, South and West sides correctly', () => { - const tile = new TileOnBoard(Grass, [Road, Town, Grass, River]); - - assert.strictEqual(tile.getSide(North), Road); - assert.strictEqual(tile.getSide(East), Town); - assert.strictEqual(tile.getSide(South), Grass); - assert.strictEqual(tile.getSide(West), River); - }); - - it('Should respect tile orientation', () => { - const tile = new TileOnBoard(Grass, [Road, Town, Grass, River]); - tile.rotate(5); - - assert.strictEqual(tile.getSide(North), River); - assert.strictEqual(tile.getSide(East), Road); - assert.strictEqual(tile.getSide(South), Town); - assert.strictEqual(tile.getSide(West), Grass); - }); - - it('Should work with negative orientation', () => { - const tile = new TileOnBoard(Grass, [Road, Town, Grass, River]); - tile.rotate(-7); - - assert.strictEqual(tile.getSide(North), River); - assert.strictEqual(tile.getSide(East), Road); - assert.strictEqual(tile.getSide(South), Town); - assert.strictEqual(tile.getSide(West), Grass); - }); - }); - - describe('getAttachments', () => { - it('Should correclty list legal attachments', () => { - const attachTo = new TileOnBoard(Town, [Road, Town, Town, Road]) - const tile = new TileOnBoard(Road, [Grass, Road, Road, Grass]) - - const attachments = attachTo.getAttachments(tile); - assert.strictEqual(attachments.length, 4); - assert.deepStrictEqual(attachments[0], { side: 0, orientation: 0, tile, attachTo }); - assert.deepStrictEqual(attachments[1], { side: 0, orientation: 1, tile, attachTo }); - assert.deepStrictEqual(attachments[2], { side: 3, orientation: 0, tile, attachTo }); - assert.deepStrictEqual(attachments[3], { side: 3, orientation: 3, tile, attachTo }); - }); - }); -}); - |