diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-03-12 15:10:54 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-03-12 15:10:54 +0300 |
commit | 2e6a4a8761bf037283f7eb8dbfd57ab7b9e977a9 (patch) | |
tree | 22012ec08067f92d8baf9ab3039f3f7cda3e7402 /src/Cell/Cell.test.ts | |
parent | 8aa2213390e01996e3f9682abfd5910c698df0e2 (diff) | |
download | carcassonne-engine-ts-2e6a4a8761bf037283f7eb8dbfd57ab7b9e977a9.tar.gz |
refactor: rename Cell -> Tile, Item -> Feature
Diffstat (limited to 'src/Cell/Cell.test.ts')
-rw-r--r-- | src/Cell/Cell.test.ts | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/Cell/Cell.test.ts b/src/Cell/Cell.test.ts deleted file mode 100644 index be6f475..0000000 --- a/src/Cell/Cell.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import assert from 'assert'; -import Cell, { Direction, Item } from './Cell'; - -const { North, East, South, West } = Direction; -const { Road, Town, Empty, River } = Item; - -describe('Cell', () => { - describe('getSide', () => { - it('Should get North, East, South and West sides correctly', () => { - const cell = new Cell(Empty, [Road, Town, Empty, River]); - - assert.strictEqual(cell.getSide(North), Road); - assert.strictEqual(cell.getSide(East), Town); - assert.strictEqual(cell.getSide(South), Empty); - assert.strictEqual(cell.getSide(West), River); - }); - - it('Should respect cell orientation', () => { - const cell = new Cell(Empty, [Road, Town, Empty, River]); - cell.rotate(5); - - assert.strictEqual(cell.getSide(North), River); - assert.strictEqual(cell.getSide(East), Road); - assert.strictEqual(cell.getSide(South), Town); - assert.strictEqual(cell.getSide(West), Empty); - }); - - it('Should work with negative orientation', () => { - const cell = new Cell(Empty, [Road, Town, Empty, River]); - cell.rotate(-7); - - assert.strictEqual(cell.getSide(North), River); - assert.strictEqual(cell.getSide(East), Road); - assert.strictEqual(cell.getSide(South), Town); - assert.strictEqual(cell.getSide(West), Empty); - }); - }); - - describe('getAttachments', () => { - it('Should correclty list legal attachments', () => { - const attachTo = new Cell(Town, [Road, Town, Town, Road]) - const cell = new Cell(Road, [Empty, Road, Road, Empty]) - - cell.print(); - attachTo.print(); - - const attachments = attachTo.getAttachments(cell); - assert.strictEqual(attachments.length, 4); - assert.deepStrictEqual(attachments[0], { side: 0, rotation: 0, cell, attachTo }); - assert.deepStrictEqual(attachments[1], { side: 0, rotation: 1, cell, attachTo }); - assert.deepStrictEqual(attachments[2], { side: 3, rotation: 0, cell, attachTo }); - assert.deepStrictEqual(attachments[3], { side: 3, rotation: 3, cell, attachTo }); - }); - }); -}); - |