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

DaniSomoza / galactic-commander / 15029782185

14 May 2025 07:52PM UTC coverage: 47.664% (-4.4%) from 52.086%
15029782185

Pull #12

github

web-flow
Merge d58e631f3 into a8e301a23
Pull Request #12: [fleets] Explore planets

216 of 930 branches covered (23.23%)

Branch coverage included in aggregate %.

162 of 529 new or added lines in 56 files covered. (30.62%)

10 existing lines in 9 files now uncovered.

1569 of 2815 relevant lines covered (55.74%)

3.43 hits per line

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

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

3
import { StartBuildUnitsTaskData, 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!
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
  return taskData as StartBuildUnitsTaskData
×
64
}
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