```text
refactor: Add schedule_parser.go and schedule_parser_test.go The code changes introduce a new `schedule_parser.go` file and its corresponding test file `schedule_parser_test.go`. These files contain the implementation and tests for the `FindWaypoints` function, which extracts waypoints from a given message. This addition enhances the functionality of the code by providing a way to parse and retrieve specific information from messages.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package parsers
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Schedule Parser", func() {
|
||||
|
||||
Describe("FindWaypoints", func() {
|
||||
It("should return the correct waypoints based on the message", func() {
|
||||
message := "1845(11JUN)TSN/2100"
|
||||
waypoints := FindWaypoints(message)
|
||||
Expect(waypoints).NotTo(BeNil())
|
||||
Expect(waypoints[ArrivalTime]).To(Equal("1845(11JUN)"))
|
||||
Expect(waypoints[AirportCode]).To(Equal("TSN"))
|
||||
Expect(waypoints[DepartureTime]).To(Equal("2100"))
|
||||
})
|
||||
|
||||
It("should return nil if no waypoints are found", func() {
|
||||
message := "1845TSN"
|
||||
waypoints := FindWaypoints(message)
|
||||
Expect(waypoints).To(BeNil())
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user