Skip to content
Snippets Groups Projects
Commit ba9f0a58 authored by Paul-louis Gomis's avatar Paul-louis Gomis
Browse files

test player.ts

parent 7eea051b
No related branches found
No related tags found
No related merge requests found
import { io, Socket } from "socket.io-client";
import Player from "./Player";
import { Sushi } from "./Ressources";
(global as any).Image = function () {};
describe("sizeIncrease", () => {
it("should increase by 0.5", function () {
const p = new Player(0, 0, 20, "goku", 1, 1, "test");
const sushis: Sushi[] = [new Sushi(0, 0, 5)];
const socket: Socket = io();
p.eatSushi(sushis, socket);
expect(p.radius).toBe(20.5);
});
it("should change form every 80", function () {
const p = new Player(0, 0, 79.5, "goku", 1, 1, "test");
const sushis: Sushi[] = [new Sushi(0, 0, 5)];
const socket: Socket = io();
p.eatSushi(sushis, socket);
expect(p.image.src).toBe("/images/character/goku/goku2.png");
});
});
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment