Skip to content

Commit

Permalink
feat(server): return course in ship endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlatz committed May 9, 2024
1 parent 0581cdc commit 4578698
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/src/controllers/ShipController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ModelFactory from '../../test/ModelFactory';
import AuthenticationGuard from '../guards/AuthenticationGuard';
import AuthenticationMethodRepository from '../repositories/AuthenticationMethodRepository';
import User from '../models/User';
import OrientationInDegrees from '../values/OrientationInDegrees';

describe('ShipController', () => {
let shipController: ShipController;
Expand Down Expand Up @@ -58,6 +59,7 @@ describe('ShipController', () => {
speed: 200,
name: 'Europa Report',
currentPosition: new Position(3, 4),
currentCourse: new OrientationInDegrees(88),
destinationPosition: new Position(23, 17),
}),
];
Expand Down Expand Up @@ -86,6 +88,7 @@ describe('ShipController', () => {
speedInKilometersPerSecond: 100,
currentPosition: { x: 1, y: 1 },
currentLocation: { name: 'Earth' },
currentCourse: 0,
destinationPosition: null,
destinationLocation: null,
timeToDestination: null,
Expand All @@ -103,6 +106,7 @@ describe('ShipController', () => {
speedInKilometersPerSecond: 200,
currentPosition: { x: 3, y: 4 },
currentLocation: { name: 'Earth' },
currentCourse: 88,
destinationPosition: { x: 23, y: 17 },
destinationLocation: { name: 'Earth' },
timeToDestination: null,
Expand All @@ -125,6 +129,7 @@ describe('ShipController', () => {
speed: 100,
name: 'Discovery One',
currentPosition: new Position(1, 2),
currentCourse: new OrientationInDegrees(0),
destinationPosition: null,
});
jest
Expand All @@ -147,6 +152,7 @@ describe('ShipController', () => {
name: 'Discovery One',
speedInKilometersPerSecond: 100,
currentPosition: { x: 1, y: 2 },
currentCourse: 0,
currentLocation: { name: 'Earth' },
destinationPosition: null,
destinationLocation: null,
Expand All @@ -167,6 +173,7 @@ describe('ShipController', () => {
speed: 100,
name: 'Discovery One',
currentPosition: new Position(1, 2),
currentCourse: new OrientationInDegrees(84),
destinationPosition: new Position(3, 4),
});
jest
Expand Down Expand Up @@ -194,6 +201,7 @@ describe('ShipController', () => {
name: 'Discovery One',
speedInKilometersPerSecond: 100,
currentPosition: { x: 1, y: 2 },
currentCourse: 84,
currentLocation: { name: 'Earth' },
destinationPosition: { x: 3, y: 4 },
destinationLocation: { name: 'Moon' },
Expand Down
1 change: 1 addition & 0 deletions server/src/controllers/ShipController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class ShipController {
x: ship.currentPosition.x,
y: ship.currentPosition.y,
},
currentCourse: ship.currentCourse.value,
currentLocation: currentLocation
? { name: currentLocation.name }
: null,
Expand Down

0 comments on commit 4578698

Please sign in to comment.