oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package personapi
2
3import (
4 "amadan.net/oficina/equipo/internal/equipo/kernel"
5 "context"
6 "encoding/json"
7 "testing"
8)
9
10func TestNotificationCapabilityOptIn(t *testing.T) {
11 for _, enabled := range []bool{false, true} {
12 h := Handler{NotificationActions: func() bool { return enabled }}
13 out, err := h.read(context.Background(), kernel.Actor{}, "capabilities", "", "", 0)
14 if err != nil {
15 t.Fatal(err)
16 }
17 raw, err := json.Marshal(out.Value)
18 if err != nil {
19 t.Fatal(err)
20 }
21 var value map[string]any
22 if err := json.Unmarshal(raw, &value); err != nil {
23 t.Fatal(err)
24 }
25 if value["notification_actions_v1"] != enabled {
26 t.Fatal(string(raw))
27 }
28 }
29}
30