From 8fa045b5c08493f99e1456dc3632c0175b515ce8 Mon Sep 17 00:00:00 2001
From: Pascal Bleser
Date: Wed, 10 Jun 2026 13:49:12 +0200
Subject: [PATCH] groupware: jmap: add a test for Invocation seriaization
---
pkg/jmap/tools_test.go | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/pkg/jmap/tools_test.go b/pkg/jmap/tools_test.go
index 0ddf3fb1e0..8f2f7a3f91 100644
--- a/pkg/jmap/tools_test.go
+++ b/pkg/jmap/tools_test.go
@@ -2,6 +2,9 @@ package jmap
import (
"encoding/json"
+ "fmt"
+ "math/rand"
+ "strconv"
"testing"
"github.com/stretchr/testify/require"
@@ -33,3 +36,12 @@ func TestSquashKeyedStates(t *testing.T) {
})
require.Equal("a:aaa,b:bbb,c:ccc", string(result))
}
+
+func TestInvocationMarshalling(t *testing.T) {
+ tag := strconv.Itoa(1000 + rand.Intn(1000))
+ accountId := fmt.Sprintf("a%d", 100+rand.Intn(100))
+ inv := invocation(IdentityGetCommand{AccountId: AccountId(accountId), Ids: []string{"x", "y", "z"}}, tag)
+ b, err := json.Marshal(inv)
+ require.NoError(t, err)
+ require.Equal(t, fmt.Sprintf(`{"Command":"Identity/get","Parameters":{"accountId":"%s","ids":["x","y","z"]},"Tag":"%s"}`, accountId, tag), string(b))
+}