refactor: Update ARR body parsing logic

The code changes in `pattern_test.go` update the ARR body parsing logic. The message body parsing now correctly handles ARR bodies with a different pattern format. This ensures accurate extraction of data based on patterns and improves the overall functionality of the code.
This commit is contained in:
windyboy
2024-07-23 16:45:03 +08:00
parent 12a9da1ca1
commit 6d1364df7e
7 changed files with 187 additions and 74 deletions
+2 -2
View File
@@ -24,12 +24,12 @@ var _ = Describe("Pattern Parser", func() {
Describe("ParseBody", func() {
It("should parse the message body and extract data based on patterns", func() {
message := "(ARR-AB123-SSR1234-KJFK-KLAX1234)"
message := "(ARR-AB123/A1234-KJFK-KLAX1234)"
parsedData := ParseBody(message)
Expect(parsedData).NotTo(BeNil())
Expect(parsedData["category"]).To(Equal("ARR"))
Expect(parsedData["number"]).To(Equal("AB123"))
Expect(parsedData["ssr"]).To(Equal("SSR1234"))
Expect(parsedData["ssr"]).To(Equal("A1234"))
Expect(parsedData["departure"]).To(Equal("KJFK"))
Expect(parsedData["arrival"]).To(Equal("KLAX"))
})