import sinon from "sinon"; import SpeedService from "../../src/services/speed.service"; /** * Mocks speed-threshold data * @param {{[p: string]: string}} thresholdMap */ export function mockSpeedThreshold(thresholdMap: { [k: string]: number }): void { sinon.stub(SpeedService.prototype, "getThresholdCache").value((campaignId: any) => { return { speed_threshold: thresholdMap[campaignId] || null, }; }); sinon.stub(SpeedService.prototype as any, "loadCampaignThresholds").value(async () => new Map()); }