Skip to content

Commit

Permalink
Added types
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Moldovia committed Jun 10, 2023
1 parent d341e23 commit 2b3f410
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 115 deletions.
5 changes: 5 additions & 0 deletions src/__tests__/creature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { Creature } from '../creature';
import { jest, expect, describe, test, beforeEach } from '@jest/globals';
import { Player } from '../player';

// NOTE: ts-comments are necessary in this file to avoid mocking the entire game.
/* eslint-disable @typescript-eslint/ban-ts-comment */

describe('Creature', () => {
describe('creature.id', () => {
let game;
Expand Down Expand Up @@ -31,11 +34,13 @@ describe('Creature', () => {
const game = getGameMock();
const obj = getCreatureObjMock();
obj.temp = true;
// @ts-ignore
const creatureTemp = new Creature(obj, game);
expect(game.creatures.length).toBe(1);
expect(game.creatures.filter((c) => c)[0]).toStrictEqual(creatureTemp);

obj.temp = false;
// @ts-ignore
const creatureNotTemp = new Creature(obj, game);
expect(game.creatures.length).toBe(1);
expect(game.creatures.filter((c) => c)[0]).not.toStrictEqual(creatureTemp);
Expand Down
Loading

0 comments on commit 2b3f410

Please sign in to comment.