refactor: Add FlightSchedule.Index field and update parsers

The code changes introduce a new `Index` field in the `FlightSchedule` struct and update the parsers in `aviation_parser.go` and `schedule_parser.go` to handle this field. This addition allows for the extraction and parsing of the `Index` value from flight schedule messages. The changes improve the functionality and accuracy of the code when working with flight schedules.
This commit is contained in:
windyboy
2024-07-29 17:54:52 +08:00
parent bb4faf4d13
commit 8593f6ce9d
4 changed files with 116 additions and 7 deletions
+21
View File
@@ -23,4 +23,25 @@ var _ = Describe("Schedule Parser", func() {
Expect(waypoints).To(BeNil())
})
})
Describe("Parsing one line of schedule", func() {
Context("parse : W/Z FM9134 B2688 1/1ILS (00) TSN0100 SHA", func() {
lineText := "W/Z FM9134 B2688 1/1ILS (00) TSN0100 SHA"
schedule := ParseLine(lineText)
It("should return a valid schedule", func() {
Expect(schedule).NotTo(BeNil())
Expect(schedule.Task).To(Equal("W/Z"))
// Expect(schedule.Date).To(Equal("TSN0100"))
// Expect(schedule.Task).To(Equal("1/1"))
Expect(schedule.FlightNumber).To(Equal("FM9134"))
Expect(schedule.AircraftReg).To(Equal("B2688"))
// Expect(schedule.PassengerConfig).To(Equal("1/1"))
// Expect(schedule.ILS).To(Equal("ILS (00)"))
// Expect(schedule.DepartureAirport).To(Equal("TSN"))
// Expect(schedule.DepartureTime).To(Equal("0100"))
// Expect(schedule.ScheduleInfo).To(Equal("SHA"))
})
})
})
})