diff --git a/back/server.ts b/back/server.ts index 4ed443b8..1e474ec9 100644 --- a/back/server.ts +++ b/back/server.ts @@ -1,15 +1,15 @@ // lib/server.ts import App from "./src/App"; import grpc from "grpc"; -import {roomManager} from "./src/RoomManager"; -import {IRoomManagerServer, RoomManagerService} from "./src/Messages/generated/messages_grpc_pb"; -import {HTTP_PORT, GRPC_PORT} from "./src/Enum/EnvironmentVariable"; +import { roomManager } from "./src/RoomManager"; +import { IRoomManagerServer, RoomManagerService } from "./src/Messages/generated/messages_grpc_pb"; +import { HTTP_PORT, GRPC_PORT } from "./src/Enum/EnvironmentVariable"; -App.listen(HTTP_PORT, () => console.log(`WorkAdventure HTTP API starting on port %d!`, HTTP_PORT)) +App.listen(HTTP_PORT, () => console.log(`WorkAdventure HTTP API starting on port %d!`, HTTP_PORT)); const server = new grpc.Server(); server.addService(RoomManagerService, roomManager); server.bind(`0.0.0.0:${GRPC_PORT}`, grpc.ServerCredentials.createInsecure()); server.start(); -console.log('WorkAdventure HTTP/2 API starting on port %d!', GRPC_PORT); +console.log("WorkAdventure HTTP/2 API starting on port %d!", GRPC_PORT); diff --git a/front/tests/Phaser/Game/PlayerMovementTest.ts b/front/tests/Phaser/Game/PlayerMovementTest.ts index bd5f40b4..95b84f0b 100644 --- a/front/tests/Phaser/Game/PlayerMovementTest.ts +++ b/front/tests/Phaser/Game/PlayerMovementTest.ts @@ -1,22 +1,24 @@ import "jasmine"; -import {PlayerMovement} from "../../../src/Phaser/Game/PlayerMovement"; +import { PlayerMovement } from "../../../src/Phaser/Game/PlayerMovement"; describe("Interpolation / Extrapolation", () => { it("should interpolate", () => { - const playerMovement = new PlayerMovement({ - x: 100, y: 200 - }, 42000, + const playerMovement = new PlayerMovement( + { + x: 100, + y: 200, + }, + 42000, { x: 200, y: 100, oldX: 100, oldY: 200, moving: true, - direction: "up" + direction: "up", }, 42200 - ); - + ); expect(playerMovement.isOutdated(42100)).toBe(false); expect(playerMovement.isOutdated(43000)).toBe(true); @@ -26,8 +28,8 @@ describe("Interpolation / Extrapolation", () => { y: 150, oldX: 100, oldY: 200, - direction: 'up', - moving: true + direction: "up", + moving: true, }); expect(playerMovement.getPosition(42200)).toEqual({ @@ -35,8 +37,8 @@ describe("Interpolation / Extrapolation", () => { y: 100, oldX: 100, oldY: 200, - direction: 'up', - moving: true + direction: "up", + moving: true, }); expect(playerMovement.getPosition(42300)).toEqual({ @@ -44,22 +46,25 @@ describe("Interpolation / Extrapolation", () => { y: 50, oldX: 100, oldY: 200, - direction: 'up', - moving: true + direction: "up", + moving: true, }); }); it("should not extrapolate if we stop", () => { - const playerMovement = new PlayerMovement({ - x: 100, y: 200 - }, 42000, + const playerMovement = new PlayerMovement( + { + x: 100, + y: 200, + }, + 42000, { x: 200, y: 100, oldX: 100, oldY: 200, moving: false, - direction: "up" + direction: "up", }, 42200 ); @@ -69,22 +74,25 @@ describe("Interpolation / Extrapolation", () => { y: 100, oldX: 100, oldY: 200, - direction: 'up', - moving: false + direction: "up", + moving: false, }); }); it("should keep moving until it stops", () => { - const playerMovement = new PlayerMovement({ - x: 100, y: 200 - }, 42000, + const playerMovement = new PlayerMovement( + { + x: 100, + y: 200, + }, + 42000, { x: 200, y: 100, oldX: 100, oldY: 200, moving: false, - direction: "up" + direction: "up", }, 42200 ); @@ -94,8 +102,8 @@ describe("Interpolation / Extrapolation", () => { y: 150, oldX: 100, oldY: 200, - direction: 'up', - moving: false + direction: "up", + moving: false, }); }); -}) +});