fix: scope page insights to reporting periods
This commit is contained in:
@@ -14,6 +14,18 @@ type schedulingRepository struct {
|
||||
created []CreateRequest
|
||||
}
|
||||
|
||||
type periodLookupRepository struct {
|
||||
schedulingRepository
|
||||
module Module
|
||||
periodID string
|
||||
}
|
||||
|
||||
func (r *periodLookupRepository) LatestForPeriod(_ context.Context, _ int64, _ string, module Module, periodID string) (Snapshot, error) {
|
||||
r.module = module
|
||||
r.periodID = periodID
|
||||
return Snapshot{Module: module}, nil
|
||||
}
|
||||
|
||||
type processingRepository struct {
|
||||
schedulingRepository
|
||||
completion Completion
|
||||
@@ -155,3 +167,16 @@ func TestService_RefreshForPeriodScopesFingerprintAndRequest(t *testing.T) {
|
||||
t.Fatal("different periods reused the same fingerprint")
|
||||
}
|
||||
}
|
||||
|
||||
func TestService_LatestForPeriodScopesEveryAnalyticsModule(t *testing.T) {
|
||||
repository := &periodLookupRepository{}
|
||||
service := NewService(repository, fixedBuilder{})
|
||||
period := PeriodScope{PeriodID: "jm-1405-05"}
|
||||
|
||||
if _, err := service.LatestForPeriod(t.Context(), 1, "", ModuleOverview, period); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if repository.module != ModuleOverview || repository.periodID != period.PeriodID {
|
||||
t.Fatalf("period lookup = %s %s, want %s %s", repository.module, repository.periodID, ModuleOverview, period.PeriodID)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user