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

DaniSomoza / galactic-commander / 12457084446

22 Dec 2024 07:29PM UTC coverage: 52.086% (-13.5%) from 65.587%
12457084446

Pull #11

github

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

206 of 790 branches covered (26.08%)

Branch coverage included in aggregate %.

366 of 893 new or added lines in 84 files covered. (40.99%)

10 existing lines in 7 files now uncovered.

1417 of 2326 relevant lines covered (60.92%)

3.83 hits per line

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

70.59
/packages/game-api-microservice/src/utils/cleanTaskFields.ts
1
import { ITaskDocument } from 'game-engine/models/TaskModel'
2

3
import { TaskType, TaskTypesTypes } from '../types/Task'
4

5
function cleanTaskFields(task: ITaskDocument): TaskType<TaskTypesTypes> {
6
  const {
7
    _id,
8
    type,
9
    data,
10
    universeId,
11
    isCancellable,
12
    status,
13
    executeTaskAt,
14
    processedAt,
15
    processingDuration,
16
    history,
17
    errorDetails
18
  } = task
4✔
19

20
  return {
4✔
21
    taskId: _id.toString(),
22
    type,
23
    data: cleanTaskDataFields(data),
24
    universeId,
25
    isCancellable,
26
    status,
27
    executeTaskAt,
28
    processedAt,
29
    processingDuration,
30
    history,
31
    errorDetails
32
  }
33
}
34

35
export default cleanTaskFields
2✔
36

37
function cleanTaskDataFields(taskData: ITaskDocument['data']): TaskType<TaskTypesTypes>['data'] {
38
  // NewPlayerTaskType
39
  if ('username' in taskData) {
4✔
40
    const { username, email, raceId } = taskData
2✔
41
    return { username, email, raceId }
2✔
42
  }
43

44
  // FinishResearchTaskType
45
  if ('researchDuration' in taskData) {
2!
NEW
46
    const { playerId, researchId, researchDuration, researchResourceCost } = taskData
×
47
    return {
×
48
      playerId,
49
      researchId,
50
      researchDuration,
51
      researchResourceCost
52
    }
53
  }
54

55
  // StartResearchTaskType
56
  if ('researchId' in taskData) {
2✔
57
    const { playerId, researchId } = taskData
2✔
58

59
    return { playerId, researchId }
2✔
60
  }
61

62
  // StartBuildUnitsTaskType or FinishBuildUnitsTaskType
NEW
63
  const { playerId, planetId, build } = taskData
×
64

NEW
65
  return {
×
66
    build,
67
    playerId,
68
    planetId
69
  }
70
}
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

© 2026 Coveralls, Inc