Add test for calculateLength()
Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
@@ -104,15 +104,15 @@ function transformLocation(input: any): ServiceLocation[] {
|
||||
return output
|
||||
}
|
||||
|
||||
function calculateLength(input: TrainServices): number | undefined {
|
||||
export function calculateLength(input: any): number | undefined {
|
||||
let length: number;
|
||||
if (input?.length) {
|
||||
length = input.length
|
||||
return length
|
||||
return Number(length)
|
||||
}
|
||||
if (input?.formation?.coaches?.coach) {
|
||||
length = input.formation.coaches.coach.length
|
||||
return length
|
||||
return Number(length)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user