diff --git a/server/server_test.go b/server/server_test.go index b0b3fab..59dac49 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -843,6 +843,11 @@ func TestServer_Labels(t *testing.T) { flags: proton.MessageFlagSent, wantLabelIDs: []string{proton.AllMailLabel, proton.AllSentLabel}, }, + { + name: "scheduled flag, no actions", + flags: proton.MessageFlagScheduledSend, + wantLabelIDs: []string{proton.AllMailLabel, proton.AllSentLabel}, + }, { name: "received flag, add inbox", flags: proton.MessageFlagReceived, @@ -855,6 +860,12 @@ func TestServer_Labels(t *testing.T) { actions: []any{add(proton.SentLabel)}, wantLabelIDs: []string{proton.SentLabel, proton.AllMailLabel, proton.AllSentLabel}, }, + { + name: "scheduled flag, add scheduled", + flags: proton.MessageFlagScheduledSend, + actions: []any{add(proton.AllScheduledLabel)}, + wantLabelIDs: []string{proton.AllScheduledLabel, proton.AllMailLabel, proton.AllSentLabel}, + }, { name: "received flag, add inbox then add archive", flags: proton.MessageFlagReceived, @@ -867,6 +878,12 @@ func TestServer_Labels(t *testing.T) { actions: []any{add(proton.SentLabel), add(proton.ArchiveLabel)}, wantLabelIDs: []string{proton.ArchiveLabel, proton.AllMailLabel, proton.AllSentLabel}, }, + { + name: "scheduled flag, add scheduled then add archive", + flags: proton.MessageFlagScheduledSend, + actions: []any{add(proton.AllScheduledLabel), add(proton.ArchiveLabel)}, + wantLabelIDs: []string{proton.ArchiveLabel, proton.AllMailLabel, proton.AllSentLabel}, + }, { name: "received flag, add inbox then remove inbox", flags: proton.MessageFlagReceived, @@ -879,6 +896,12 @@ func TestServer_Labels(t *testing.T) { actions: []any{add(proton.SentLabel), rem(proton.SentLabel)}, wantLabelIDs: []string{proton.AllMailLabel, proton.AllSentLabel}, }, + { + name: "scheduled flag, add scheduled then remove scheduled", + flags: proton.MessageFlagScheduledSend, + actions: []any{add(proton.AllScheduledLabel), rem(proton.AllScheduledLabel)}, + wantLabelIDs: []string{proton.AllMailLabel, proton.AllSentLabel}, + }, { name: "received flag, add inbox then remove archive", flags: proton.MessageFlagReceived, @@ -891,6 +914,12 @@ func TestServer_Labels(t *testing.T) { actions: []any{add(proton.SentLabel), rem(proton.ArchiveLabel)}, wantLabelIDs: []string{proton.SentLabel, proton.AllMailLabel, proton.AllSentLabel}, }, + { + name: "scheduled flag, add scheduled then remove archive", + flags: proton.MessageFlagScheduledSend, + actions: []any{add(proton.AllScheduledLabel), rem(proton.ArchiveLabel)}, + wantLabelIDs: []string{proton.AllScheduledLabel, proton.AllMailLabel, proton.AllSentLabel}, + }, { name: "received flag, add inbox then remove inbox then add archive", flags: proton.MessageFlagReceived, @@ -903,6 +932,12 @@ func TestServer_Labels(t *testing.T) { actions: []any{add(proton.SentLabel), rem(proton.SentLabel), add(proton.ArchiveLabel)}, wantLabelIDs: []string{proton.ArchiveLabel, proton.AllMailLabel, proton.AllSentLabel}, }, + { + name: "scheduled flag, add scheduled then remove scheduled then add archive", + flags: proton.MessageFlagScheduledSend, + actions: []any{add(proton.AllScheduledLabel), rem(proton.AllScheduledLabel), add(proton.ArchiveLabel)}, + wantLabelIDs: []string{proton.ArchiveLabel, proton.AllMailLabel, proton.AllSentLabel}, + }, { name: "received flag, add starred", flags: proton.MessageFlagReceived, @@ -915,6 +950,12 @@ func TestServer_Labels(t *testing.T) { actions: []any{add(proton.StarredLabel)}, wantLabelIDs: []string{proton.StarredLabel, proton.AllMailLabel, proton.AllSentLabel}, }, + { + name: "scheduled flag, add starred", + flags: proton.MessageFlagScheduledSend, + actions: []any{add(proton.StarredLabel)}, + wantLabelIDs: []string{proton.StarredLabel, proton.AllMailLabel, proton.AllSentLabel}, + }, { name: "received flag, add inbox, add starred, remove inbox", flags: proton.MessageFlagReceived, @@ -927,6 +968,12 @@ func TestServer_Labels(t *testing.T) { actions: []any{add(proton.SentLabel), add(proton.StarredLabel), rem(proton.SentLabel)}, wantLabelIDs: []string{proton.StarredLabel, proton.AllMailLabel, proton.AllSentLabel}, }, + { + name: "scheduled flag, add scheduled, add starred, remove scheduled", + flags: proton.MessageFlagScheduledSend, + actions: []any{add(proton.AllScheduledLabel), add(proton.StarredLabel), rem(proton.AllScheduledLabel)}, + wantLabelIDs: []string{proton.StarredLabel, proton.AllMailLabel, proton.AllSentLabel}, + }, { name: "received flag, add trash, remove trash", flags: proton.MessageFlagReceived, @@ -939,12 +986,24 @@ func TestServer_Labels(t *testing.T) { actions: []any{add(proton.TrashLabel), rem(proton.TrashLabel)}, wantLabelIDs: []string{proton.AllMailLabel, proton.AllSentLabel}, }, + { + name: "scheduled flag, add trash, remove trash", + flags: proton.MessageFlagScheduledSend, + actions: []any{add(proton.TrashLabel), rem(proton.TrashLabel)}, + wantLabelIDs: []string{proton.AllMailLabel, proton.AllSentLabel}, + }, { name: "received flag, add inbox, add trash, remove inbox", flags: proton.MessageFlagReceived, actions: []any{add(proton.InboxLabel), add(proton.TrashLabel), rem(proton.InboxLabel)}, wantLabelIDs: []string{proton.AllMailLabel, proton.TrashLabel}, }, + { + name: "scheduled & sent flags, add scheduled, add sent", + flags: proton.MessageFlagScheduledSend | proton.MessageFlagSent, + actions: []any{add(proton.AllScheduledLabel), add(proton.SentLabel)}, + wantLabelIDs: []string{proton.AllMailLabel, proton.SentLabel, proton.AllSentLabel}, + }, } withServer(t, func(ctx context.Context, s *Server, m *proton.Manager) {