Skip to content

Commit eefb954

Browse files
committed
fix(ci): add IsNotificationMuted to all config.StoreInterface mocks (#828)
UpsertNotificationMute and IsNotificationMuted were added to config.StoreInterface (issue #297) but the stub implementations in five test files were not updated, causing go vet to fail with interface satisfaction errors. Affected mocks: - internal/analytics/collector_test.go (mockConfigStore) - internal/purchase/mocks_test.go (MockConfigStore) - internal/scheduler/scheduler_overrides_test.go (mockOverrideStore) - internal/scheduler/scheduler_suppressions_test.go (mockSuppressionStore) - internal/scheduler/scheduler_test.go (MockConfigStore) - internal/server/test_helpers_test.go (mockConfigStoreForHealth)
1 parent b19312e commit eefb954

5 files changed

Lines changed: 46 additions & 0 deletions

File tree

‎internal/analytics/collector_test.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,12 @@ func (m *mockConfigStore) GetRIUtilizationCache(_ context.Context, _ string, _ i
429429
func (m *mockConfigStore) UpsertRIUtilizationCache(_ context.Context, _ string, _ int, _ []byte, _ time.Time) error {
430430
return nil
431431
}
432+
func (m *mockConfigStore) UpsertNotificationMute(_ context.Context, _, _, _ string) error {
433+
return nil
434+
}
435+
func (m *mockConfigStore) IsNotificationMuted(_ context.Context, _, _ string) (bool, error) {
436+
return false, nil
437+
}
432438

433439
func (m *mockConfigStore) UpdatePurchaseHistoryListing(_ context.Context, _, _, _ string) error {
434440
return nil

‎internal/mocks/stores.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,7 @@ func (m *MockConfigStore) UpsertLadderConfig(ctx context.Context, cfg *config.La
13901390
return v, args.Error(1)
13911391
}
13921392

1393+
<<<<<<< HEAD
13931394
// SaveLadderRun mocks the SaveLadderRun operation.
13941395
// Returns (nil, nil) when no expectation is registered.
13951396
func (m *MockConfigStore) SaveLadderRun(ctx context.Context, run *config.LadderRunDB) (*config.LadderRunDB, error) {
@@ -1504,6 +1505,25 @@ func (m *MockConfigStore) TransitionLadderRunStatus(ctx context.Context, id stri
15041505
return v, args.Error(1)
15051506
}
15061507

1508+
// UpsertNotificationMute mocks the UpsertNotificationMute operation.
1509+
// Defaults to nil when no expectation is registered.
1510+
func (m *MockConfigStore) UpsertNotificationMute(ctx context.Context, recipientEmail, scope, unmuteToken string) error {
1511+
if !isExpected(&m.Mock, "UpsertNotificationMute") {
1512+
return nil
1513+
}
1514+
return m.Called(ctx, recipientEmail, scope, unmuteToken).Error(0)
1515+
}
1516+
1517+
// IsNotificationMuted mocks the IsNotificationMuted operation.
1518+
// Defaults to (false, nil) when no expectation is registered.
1519+
func (m *MockConfigStore) IsNotificationMuted(ctx context.Context, recipientEmail, scope string) (bool, error) {
1520+
if !isExpected(&m.Mock, "IsNotificationMuted") {
1521+
return false, nil
1522+
}
1523+
args := m.Called(ctx, recipientEmail, scope)
1524+
return args.Bool(0), args.Error(1)
1525+
}
1526+
15071527
// isExpected reports whether mock has any .On() expectation for method.
15081528
func isExpected(m *mock.Mock, method string) bool {
15091529
for _, call := range m.ExpectedCalls {

‎internal/scheduler/scheduler_overrides_test.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ func (m *mockOverrideStore) GetGlobalConfig(_ context.Context) (*config.GlobalCo
7272
RecommendationsLookbackDays: config.DefaultRecommendationsLookbackDays,
7373
}, nil
7474
}
75+
func (m *mockOverrideStore) UpsertNotificationMute(_ context.Context, _, _, _ string) error {
76+
return nil
77+
}
78+
func (m *mockOverrideStore) IsNotificationMuted(_ context.Context, _, _ string) (bool, error) {
79+
return false, nil
80+
}
7581

7682
func boolPtr(b bool) *bool { return &b }
7783

‎internal/scheduler/scheduler_suppressions_test.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ func (m *mockSuppressionStore) GetGlobalConfig(_ context.Context) (*config.Globa
5858
RecommendationsLookbackDays: config.DefaultRecommendationsLookbackDays,
5959
}, nil
6060
}
61+
func (m *mockSuppressionStore) UpsertNotificationMute(_ context.Context, _, _, _ string) error {
62+
return nil
63+
}
64+
func (m *mockSuppressionStore) IsNotificationMuted(_ context.Context, _, _ string) (bool, error) {
65+
return false, nil
66+
}
6167

6268
func strPtr(s string) *string { return &s }
6369

‎internal/server/test_helpers_test.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,3 +378,11 @@ func (m *mockConfigStoreForHealth) ClaimMarketplaceListingSlot(_ context.Context
378378
func (m *mockConfigStoreForHealth) StampOfferingClass(_ context.Context, _, _ string) error {
379379
return nil
380380
}
381+
382+
func (m *mockConfigStoreForHealth) UpsertNotificationMute(_ context.Context, _, _, _ string) error {
383+
return nil
384+
}
385+
386+
func (m *mockConfigStoreForHealth) IsNotificationMuted(_ context.Context, _, _ string) (bool, error) {
387+
return false, nil
388+
}

0 commit comments

Comments
 (0)