feat(office): users admin UI, table rendering, and user save fixes
Add Users list/detail with ACL toggles and library people update/status APIs. Fix project table layout and ANSI-safe cell rendering, and decode array responses from people/status so saves no longer fail on JSON unmarshal. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package onlyoffice
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUnmarshalResponseObjectMap(t *testing.T) {
|
||||
raw := json.RawMessage(`{"response":{"id":"1","isAdmin":true}}`)
|
||||
out, err := unmarshalResponseObject(raw)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if out["id"] != "1" || out["isAdmin"] != true {
|
||||
t.Fatalf("unexpected map: %#v", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalResponseObjectArray(t *testing.T) {
|
||||
raw := json.RawMessage(`{"response":[{"id":"a"},{"id":"b"}]}`)
|
||||
out, err := unmarshalResponseObject(raw)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if out["id"] != "a" {
|
||||
t.Fatalf("expected first array element, got %#v", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalResponseObjectEmptyArray(t *testing.T) {
|
||||
raw := json.RawMessage(`{"response":[]}`)
|
||||
out, err := unmarshalResponseObject(raw)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if out != nil {
|
||||
t.Fatalf("expected nil for empty array, got %#v", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnmarshalResponseObjectNull(t *testing.T) {
|
||||
raw := json.RawMessage(`{"response":null}`)
|
||||
out, err := unmarshalResponseObject(raw)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if out != nil {
|
||||
t.Fatalf("expected nil, got %#v", out)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user