aboutsummaryrefslogtreecommitdiff
path: root/internal/ingest/service_order_test.go
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-26 15:41:45 -0800
committerFuwn <[email protected]>2026-02-26 15:41:45 -0800
commitfec9114caaa7d274e524793d5eb0cf2ef2c5af11 (patch)
tree0897394ccdfaf6633e1a4ca8eb02bff49bb93c00 /internal/ingest/service_order_test.go
parentfeat: add read-only PLC API compatibility endpoints (diff)
downloadplutia-test-fec9114caaa7d274e524793d5eb0cf2ef2c5af11.tar.xz
plutia-test-fec9114caaa7d274e524793d5eb0cf2ef2c5af11.zip
feat: Apply Iku formatting
Diffstat (limited to 'internal/ingest/service_order_test.go')
-rw-r--r--internal/ingest/service_order_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/ingest/service_order_test.go b/internal/ingest/service_order_test.go
index 0e2299c..1d7c766 100644
--- a/internal/ingest/service_order_test.go
+++ b/internal/ingest/service_order_test.go
@@ -2,24 +2,28 @@ package ingest
import (
"testing"
-
"github.com/Fuwn/plutia/internal/types"
)
func TestCollectVerifiedInOrder_OutOfOrderInput(t *testing.T) {
results := make(chan verifyResult, 3)
+
results <- verifyResult{index: 2, op: types.ParsedOperation{Sequence: 3}}
results <- verifyResult{index: 0, op: types.ParsedOperation{Sequence: 1}}
results <- verifyResult{index: 1, op: types.ParsedOperation{Sequence: 2}}
+
close(results)
ordered, err := collectVerifiedInOrder(3, results)
+
if err != nil {
t.Fatalf("collect verified: %v", err)
}
+
if len(ordered) != 3 {
t.Fatalf("ordered length mismatch: got %d want 3", len(ordered))
}
+
for i := 0; i < 3; i++ {
if ordered[i].op.Sequence != uint64(i+1) {
t.Fatalf("unexpected sequence at index %d: got %d want %d", i, ordered[i].op.Sequence, i+1)
@@ -29,8 +33,10 @@ func TestCollectVerifiedInOrder_OutOfOrderInput(t *testing.T) {
func TestCollectVerifiedInOrder_MissingResult(t *testing.T) {
results := make(chan verifyResult, 2)
+
results <- verifyResult{index: 0, op: types.ParsedOperation{Sequence: 1}}
results <- verifyResult{index: 2, op: types.ParsedOperation{Sequence: 3}}
+
close(results)
if _, err := collectVerifiedInOrder(3, results); err == nil {