package migration import "testing" func TestGraphWellKnownFolder(t *testing.T) { remote, ftype := graphWellKnownFolder("inbox", "Inbox") if remote != "INBOX" || ftype != "inbox" { t.Fatalf("got %q / %q", remote, ftype) } remote, ftype = graphWellKnownFolder("", "Projects") if remote != "PROJECTS" || ftype != "custom" { t.Fatalf("custom folder: got %q / %q", remote, ftype) } } func TestGraphFlags(t *testing.T) { flags := graphFlags(true, "notFlagged") if len(flags) != 1 || flags[0] != "\\Seen" { t.Fatalf("read flags: %v", flags) } flags = graphFlags(false, "flagged") if len(flags) != 1 || flags[0] != "\\Flagged" { t.Fatalf("flagged: %v", flags) } } func TestGraphRecipientsJSON(t *testing.T) { raw := graphRecipientsJSON([]graphRecipient{ {EmailAddress: graphEmailAddress{Name: "Bob", Address: "bob@example.com"}}, }) if string(raw) != `[{"name":"Bob","email":"bob@example.com"}]` { t.Fatalf("unexpected json: %s", raw) } } func TestParseGraphTime(t *testing.T) { tm := parseGraphTime("2024-05-01T12:34:56Z") if tm.IsZero() { t.Fatal("expected parsed time") } } func TestRemoteMessageUIDMatchesGmailUID(t *testing.T) { id := "abc123" if remoteMessageUID(id) != gmailUID(id) { t.Fatal("uid helpers diverged") } }