This commit adds comprehensive documentation for the new GEMINI project, detailing its architecture, tech stack, key commands, and development workflow. The documentation emphasizes the Clean Architecture principles and modular design of the application. Additionally, AGENTS.md is updated to include information about the composite parser pattern and core domain types related to aviation telegrams and weather reports, enhancing clarity on the project's structure and design choices. New Files: - GEMINI.md: Detailed project overview and architecture documentation. Updates: - AGENTS.md: Added sections on parsers and core domain types. These changes aim to improve onboarding and understanding of the project's architecture and functionality.
48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
package nats
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
|
|
"github.com/nats-io/nats.go"
|
|
)
|
|
|
|
func TestNATS(t *testing.T) {
|
|
RegisterFailHandler(Fail)
|
|
RunSpecs(t, "NATS Suite")
|
|
}
|
|
|
|
var _ = Describe("Consumer helpers", func() {
|
|
Describe("isJetStreamResourceNotFound", func() {
|
|
It("detects missing resources for known errors", func() {
|
|
Expect(isJetStreamResourceNotFound(nil)).To(BeFalse())
|
|
Expect(isJetStreamResourceNotFound(nats.ErrStreamNotFound)).To(BeTrue())
|
|
Expect(isJetStreamResourceNotFound(errors.New("consumer not found in stream not found"))).To(BeTrue())
|
|
})
|
|
})
|
|
|
|
Describe("policy mapping", func() {
|
|
It("maps deliver policies to NATS constants", func() {
|
|
tests := map[string]nats.DeliverPolicy{
|
|
"": nats.DeliverAllPolicy,
|
|
"new": nats.DeliverNewPolicy,
|
|
"LAST": nats.DeliverLastPolicy,
|
|
"last_per_subject": nats.DeliverLastPerSubjectPolicy,
|
|
"sequence": nats.DeliverByStartSequencePolicy,
|
|
"time": nats.DeliverByStartTimePolicy,
|
|
"unknown-so-far": nats.DeliverAllPolicy,
|
|
}
|
|
for input, want := range tests {
|
|
Expect(mapDeliverPolicy(input)).To(Equal(want))
|
|
}
|
|
})
|
|
|
|
It("maps replay policy to instant by default", func() {
|
|
Expect(mapReplayPolicy("original")).To(Equal(nats.ReplayOriginalPolicy))
|
|
Expect(mapReplayPolicy("")).To(Equal(nats.ReplayInstantPolicy))
|
|
})
|
|
})
|
|
}) |