fix: align meeting note payloads
This commit is contained in:
@@ -47,6 +47,50 @@ func TestPayloadUserIDsAreStrings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMeetingPayloadIncludesNamesAndDerivedEndedState(t *testing.T) {
|
||||
now := time.Now().UTC()
|
||||
userA, err := parseUserID("usrag7w9xJ6hto")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
userB, err := parseUserID("usr1RqTFgHSenM")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
payload := meetingPayload(store.Meeting{
|
||||
MeetingID: "mtg_1",
|
||||
Title: "周会",
|
||||
OrganizerID: userA,
|
||||
RecorderID: userA,
|
||||
Organizer: store.UserSummary{UserID: userA, DisplayName: "张三"},
|
||||
Recorder: store.UserSummary{UserID: userA, DisplayName: "张三"},
|
||||
StartAt: now.Add(-2 * time.Hour),
|
||||
EndAt: now.Add(-time.Hour),
|
||||
State: "scheduled",
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
Participants: []store.MeetingParticipant{
|
||||
{UserID: userB, Response: "pending", User: store.UserSummary{UserID: userB, DisplayName: "李四"}},
|
||||
},
|
||||
}, userA)
|
||||
|
||||
if payload["state"] != "ended" {
|
||||
t.Fatalf("state=%v, want ended", payload["state"])
|
||||
}
|
||||
if payload["organizer_display_name"] != "张三" {
|
||||
t.Fatalf("organizer_display_name=%v", payload["organizer_display_name"])
|
||||
}
|
||||
names, ok := payload["participant_names"].([]string)
|
||||
if !ok || len(names) != 1 || names[0] != "李四" {
|
||||
t.Fatalf("participant_names=%#v", payload["participant_names"])
|
||||
}
|
||||
participants, ok := payload["participants"].([]map[string]any)
|
||||
if !ok || len(participants) != 1 || participants[0]["display_name"] != "李四" {
|
||||
t.Fatalf("participants=%#v", payload["participants"])
|
||||
}
|
||||
}
|
||||
|
||||
func assertNoNumericUserIDs(t *testing.T, value any) {
|
||||
t.Helper()
|
||||
switch typed := value.(type) {
|
||||
|
||||
Reference in New Issue
Block a user