refactor: Update ARR body parsing logic

The code changes in `aviation_parser_test.go` update the ARR body parsing logic. The `ParseHeader` function now correctly handles ARR bodies with optional time components. This ensures accurate parsing of ARR bodies and improves the overall functionality of the aviation parser.
This commit is contained in:
windyboy
2024-07-22 08:12:18 +08:00
parent 497a33a99a
commit 12b1b47d96
3 changed files with 39 additions and 519 deletions
+24
View File
@@ -9,6 +9,30 @@ import (
var _ = Describe("Aviation Parser", func() {
Describe("ParseHeader", func() {
Context("with a real arr context", func() {
message := `ZCZC TMQ2530 141614
GG ZBTJZXZX
141614 ZSHCZTZX
(ARR-CES5470-ZBTJ-ZSHC1614)
NNNN`
It("get a clean body text", func() {
body := clean(message)
expexted := `ZCZC TMQ2530 141614
GG ZBTJZXZX
141614 ZSHCZTZX
(ARR-CES5470-ZBTJ-ZSHC1614)`
// fmt.Printf("\n%v \n%v\n", []byte(body), []byte(expexted))
Expect(body).To(Equal(expexted))
})
})
It("should parse the header correctly", func() {
message := `
ZCZC TAF6789 160530