ai cooking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

just fix test (#255)

Co-authored-by: paul miller <paul.miller>

authored by

Paul Miller
paul miller
and committed by
GitHub
e29b7a2b 1e028929

+16 -3
+16 -3
internal/mail/mail_test.go
··· 12 12 "careme/internal/cache" 13 13 "careme/internal/config" 14 14 "careme/internal/locations" 15 + "careme/internal/recipes" 15 16 "careme/internal/templates" 16 17 utypes "careme/internal/users/types" 17 18 ··· 83 84 return f.response, f.err 84 85 } 85 86 87 + func shoppingDayForStore(t *testing.T, location *locations.Location) string { 88 + t.Helper() 89 + date, err := recipes.StoreToDate(context.Background(), time.Now(), location) 90 + if err != nil { 91 + t.Fatalf("failed to resolve store date: %v", err) 92 + } 93 + return date.Weekday().String() 94 + } 95 + 86 96 func TestSendEmail_DoesNotRecordSentClaimOnNonSuccessSendGridStatus(t *testing.T) { 87 97 if err := templates.Init(&config.Config{}, "/assets/tailwind.css"); err != nil { 88 98 t.Fatalf("failed to initialize templates: %v", err) 89 99 } 90 100 91 101 fc := newFakeMailCache(t) 102 + location := &locations.Location{ID: "123", Name: "Test Store", Address: "123 Test St", ZipCode: "98005"} 92 103 m := &mailer{ 93 104 cache: fc, 94 105 locServer: &fakeMailLocServer{ 95 - location: &locations.Location{ID: "123", Name: "Test Store", Address: "123 Test St"}, 106 + location: location, 96 107 }, 97 108 client: &fakeMailClient{ 98 109 response: &rest.Response{StatusCode: 500, Body: "sendgrid internal error"}, ··· 104 115 MailOptIn: true, 105 116 Email: []string{"u1@example.com"}, 106 117 FavoriteStore: "123", 118 + ShoppingDay: shoppingDayForStore(t, location), 107 119 }) 108 120 109 121 for key := range fc.data { ··· 119 131 } 120 132 121 133 fc := newFakeMailCache(t) 134 + location := &locations.Location{ID: "123", Name: "Test Store", Address: "123 Test St", ZipCode: "98005"} 122 135 m := &mailer{ 123 136 cache: fc, 124 137 locServer: &fakeMailLocServer{ 125 - location: &locations.Location{ID: "123", Name: "Test Store", Address: "123 Test St", ZipCode: "98005"}, 138 + location: location, 126 139 }, 127 140 client: &fakeMailClient{ 128 141 response: &rest.Response{StatusCode: 202, Body: "accepted"}, ··· 134 147 MailOptIn: true, 135 148 Email: []string{"u1@example.com"}, 136 149 FavoriteStore: "123", 137 - ShoppingDay: time.Now().Weekday().String(), 150 + ShoppingDay: shoppingDayForStore(t, location), 138 151 }) 139 152 140 153 var (