From 9e48e4681487b1c69577c0e9e5f83d8d8225e494 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 11:49:45 -0500 Subject: feat: add prioritization of polling hutch-stats for logged in user --- HutchTests/ContributionCalendarTests.swift | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'HutchTests/ContributionCalendarTests.swift') diff --git a/HutchTests/ContributionCalendarTests.swift b/HutchTests/ContributionCalendarTests.swift index 4ce2f1f..9e76e42 100644 --- a/HutchTests/ContributionCalendarTests.swift +++ b/HutchTests/ContributionCalendarTests.swift @@ -93,6 +93,30 @@ struct ContributionCalendarTests { #expect(range.upperBound == endDate) } + @Test + func selfContributionRequestsIncludeExplicitPrioritySignal() { + let service = HutchStatsService( + configuration: AppConfiguration(), + currentActor: "~alice" + ) + let endDate = ContributionDateParser.parse("2026-04-11")! + let queryItems = service.contributionQueryItems(actor: "~alice", endingOn: endDate) + + #expect(queryItems.contains(URLQueryItem(name: "prioritize", value: "self"))) + } + + @Test + func otherContributionRequestsDoNotIncludePrioritySignal() { + let service = HutchStatsService( + configuration: AppConfiguration(), + currentActor: "~alice" + ) + let endDate = ContributionDateParser.parse("2026-04-11")! + let queryItems = service.contributionQueryItems(actor: "~bob", endingOn: endDate) + + #expect(queryItems.contains(URLQueryItem(name: "prioritize", value: "self")) == false) + } + @Test func contributionIntensityBucketsMatchProductRules() { #expect(ContributionIntensity(count: 0) == .empty) -- cgit v1.2.3