• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DaniSomoza / galactic-commander / 12422152220

19 Dec 2024 10:57PM UTC coverage: 52.396% (-13.2%) from 65.587%
12422152220

Pull #11

github

web-flow
Merge e0cd6a508 into 4f9f087f0
Pull Request #11: Build units

204 of 768 branches covered (26.56%)

Branch coverage included in aggregate %.

363 of 886 new or added lines in 84 files covered. (40.97%)

10 existing lines in 7 files now uncovered.

1414 of 2320 relevant lines covered (60.95%)

3.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

14.29
/packages/frontend/src/endpoints/game/buildUnitsEndpoint.ts
1
import { AxiosResponse } from 'axios'
2

3
import {
4
  BUILD_UNITS_PATH,
5
  BUILD_UNITS_QUEUE_PATH
6
} from 'game-api-microservice/src/routes/constants'
7
import {
8
  startBuildUnitsResponseType,
9
  UnitTypes,
10
  updateBuildUnitsQueueResponseType
11
} from 'game-api-microservice/src/types/Unit'
12
import { PlanetCoordinatesType } from 'game-api-microservice/src/types/Planet'
13

14
import Api from '../Api'
15

16
const gameBaseEndpoint = import.meta.env.VITE_GAME_SERVICE_ORIGIN
1✔
17

18
export async function startBuildUnits(
19
  unitName: string,
20
  amount: number,
21
  planetCoordinates: PlanetCoordinatesType,
22
  universeName: string
23
): Promise<AxiosResponse<startBuildUnitsResponseType>> {
NEW
24
  const startBuildUnitsEndpoint = `${gameBaseEndpoint}${BUILD_UNITS_PATH}`
×
25

NEW
26
  const payload = { universeName, unitName, amount, planetCoordinates }
×
27

NEW
28
  return await Api.post<startBuildUnitsResponseType, typeof payload>(
×
29
    startBuildUnitsEndpoint,
30
    payload
31
  )
32
}
33

34
export async function updateBuildUnitsQueue(
35
  buildUnitsQueue: { unitName: string; amount: number }[],
36
  planetCoordinates: PlanetCoordinatesType,
37
  unitType: UnitTypes,
38
  universeName: string
39
): Promise<AxiosResponse<updateBuildUnitsQueueResponseType>> {
NEW
40
  const updateBuildUnitsQueueEndpoint = `${gameBaseEndpoint}${BUILD_UNITS_QUEUE_PATH}`
×
41

NEW
42
  const payload = { universeName, buildUnitsQueue, planetCoordinates, unitType }
×
43

NEW
44
  return Api.post<updateBuildUnitsQueueResponseType, typeof payload>(
×
45
    updateBuildUnitsQueueEndpoint,
46
    payload
47
  )
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc