Skip to content

Commit

Permalink
feat(GODT-1264): added tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
xmichelo authored and jameshoulahan committed Feb 14, 2023
1 parent a58987d commit 4056d48
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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) {
Expand Down

0 comments on commit 4056d48

Please sign in to comment.