Create game.test.js
This commit is contained in:
18
examples/guess-the-number/game.test.js
Normal file
18
examples/guess-the-number/game.test.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { it, expect, describe, vi } from 'vitest';
|
||||||
|
import { Game } from './game';
|
||||||
|
|
||||||
|
describe('Game', () => {
|
||||||
|
it('should return an instance of a game', () => {
|
||||||
|
// This is mostly a dummy test.
|
||||||
|
const game = new Game(1, 10);
|
||||||
|
expect(game).toBeInstanceOf(Game);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have a secret number', () => {
|
||||||
|
// Thisn't really a useful test.
|
||||||
|
// Do I *really* care about the type of the secret number?
|
||||||
|
// Do I *really* care about the name of a "private" property?
|
||||||
|
const game = new Game(1, 10);
|
||||||
|
expect(game.secretNumber).toBeTypeOf('number');
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user