refactor: Add CNL message parsing logic to BodyParser
The code changes in `aviation_parser.go` and `aviation_parser_test.go` add CNL message parsing logic to the `BodyParser` module. This allows for the correct extraction and parsing of CNL messages, including the category, aircraft ID, departure airport, and destination airport. This enhancement improves the overall functionality and accuracy of the code.
This commit is contained in:
@@ -213,6 +213,21 @@ NNNN`
|
||||
})
|
||||
})
|
||||
|
||||
Context("with CNL body", func() {
|
||||
// parser := NewBodyParser()
|
||||
It("should parse the body correctly", func() {
|
||||
body := "(CNL-YZR7979-ZSPD-ZBTJ)"
|
||||
parser := NewBodyParser(body)
|
||||
category, parsedBody, err := parser.Parse()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(parsedBody).ToNot(BeNil())
|
||||
Expect(category).To(Equal("CNL"))
|
||||
Expect(parsedBody).To(BeAssignableToTypeOf(&domain.CNL{}))
|
||||
cnlMessage := parsedBody.(*domain.CNL)
|
||||
Expect(cnlMessage.AircraftID).To(Equal("YZR7979"))
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Describe("Parse whole real message", func() {
|
||||
|
||||
Reference in New Issue
Block a user