UNPKG

card-games-typescript

Version:

Card deck and high or low game library built with TypeScript

27 lines (26 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Card_1 = require("../Card"); describe('Card', () => { it('instantiates an object with correct input', () => { const validCard = new Card_1.Card("A", "clubs"); expect(validCard).toBeTruthy(); }); it('has a property called value with type number', () => { const validCard = new Card_1.Card("A", "clubs"); expect(validCard.value).toBe(14); }); it('has a property called unicode with type string', () => { const validCard = new Card_1.Card("A", "clubs"); expect(typeof (validCard.unicode)).toBe("string"); }); it('isSameCard class function returns true only if card has the same value and suite', () => { const cardOne = new Card_1.Card("A", "clubs"); const cardTwo = new Card_1.Card("A", "spades"); const cardThree = new Card_1.Card("A", "clubs"); const cardFour = new Card_1.Card("K", "clubs"); expect(cardOne.isSameCard(cardTwo)).toEqual(false); expect(cardOne.isSameCard(cardThree)).toEqual(true); expect(cardOne.isSameCard(cardFour)).toEqual(false); }); });