✨ Add configuration for Code Review Automation and enhance .gitignore. Introduce .coderabbit.yml for automated reviews with profiles for correctness, maintainability, security, and performance. Update paths to include relevant directories and exclude generated files. Modify .gitignore to include coverage reports and generated files. Refactor Docker Compose to use updated paths for database initialization scripts. Update Go module dependencies and enhance Makefile with new code generation tasks. Transition domain models to a new DTO structure for better separation of concerns.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Pattern Parser", func() {
|
||||
|
||||
Describe("FindPatterns", func() {
|
||||
It("should return the correct BodyConfig based on the message body", func() {
|
||||
message := "(ARR-AB123-SSR1234-KJFK-KLAX)"
|
||||
bodyConfig := FindPatterns(message)
|
||||
Expect(bodyConfig).NotTo(BeNil())
|
||||
// Expect(bodyConfig.Name).To(Equal("ARR"))
|
||||
})
|
||||
|
||||
It("should return nil if no pattern matches", func() {
|
||||
message := "(XYZ-123)"
|
||||
bodyConfig := FindPatterns(message)
|
||||
Expect(bodyConfig).To(BeNil())
|
||||
})
|
||||
})
|
||||
|
||||
Describe("ParseBody", func() {
|
||||
It("should parse the message body and extract data based on patterns", func() {
|
||||
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("A1234"))
|
||||
Expect(parsedData[DepartureCode]).To(Equal("KJFK"))
|
||||
Expect(parsedData[ArrivalCode]).To(Equal("KLAX"))
|
||||
})
|
||||
|
||||
It("should return nil if no patterns match", func() {
|
||||
message := "(XYZ-123)"
|
||||
parsedData := ParseBody(message)
|
||||
Expect(parsedData).To(BeNil())
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user