refactor: Add support for parsing JD Airlines flight schedule data
This commit is contained in:
@@ -112,6 +112,19 @@ var (
|
||||
3: Register,
|
||||
},
|
||||
},
|
||||
{
|
||||
/**
|
||||
* 1) JD5195 B6727 ILS I(9) SYX/0800 1135/TSN
|
||||
*/
|
||||
Airlines: []string{"JD"},
|
||||
MinLen: 7,
|
||||
WaypointStart: 5,
|
||||
Fields: map[int]string{
|
||||
0: Index,
|
||||
1: FlightNumber,
|
||||
2: Register,
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -233,4 +233,23 @@ var _ = Describe("Parse Line with PreDef", func() {
|
||||
})
|
||||
})
|
||||
|
||||
Context("JD", func() {
|
||||
It("1) JD5195 B6727 ILS I(9) SYX/0800 1135/TSN", func() {
|
||||
lineText := "1) JD5195 B6727 ILS I(9) SYX/0800 1135/TSN"
|
||||
def := FindDef("JD")
|
||||
Expect(def).NotTo(BeNil())
|
||||
schedule := ParseWithDef(lineText, def)
|
||||
Expect(schedule).NotTo(BeNil())
|
||||
Expect(schedule.Index).To(Equal("1)"))
|
||||
Expect(len(schedule.FlightNumber)).To(Equal(1))
|
||||
Expect(schedule.FlightNumber[0]).To(Equal("JD5195"))
|
||||
Expect(schedule.AircraftReg).To(Equal("B6727"))
|
||||
Expect(len(schedule.Waypoints)).To(Equal(2))
|
||||
Expect(schedule.Waypoints[0].Airport).To(Equal("SYX"))
|
||||
Expect(schedule.Waypoints[0].DepartureTime).To(Equal("0800"))
|
||||
Expect(schedule.Waypoints[1].Airport).To(Equal("TSN"))
|
||||
Expect(schedule.Waypoints[1].ArrivalTime).To(Equal("1135"))
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user