fix(campaign): bound operator queue polling
This commit is contained in:
@@ -5,7 +5,9 @@ import {
|
||||
OPERATOR_QUEUE_REASON,
|
||||
campaignLifecycleTotals,
|
||||
campaignVersionWorkItems,
|
||||
operatorDeliveryStateCounts,
|
||||
operatorQueueActionBlocks,
|
||||
shouldRefreshOperatorVersionSummary,
|
||||
type OperatorQueueFacts,
|
||||
type OperatorQueuePermissions
|
||||
} from "../src/features/operator/operatorQueueModel.ts";
|
||||
@@ -112,3 +114,38 @@ test("campaign-wide lifecycle totals are not multiplied across version rows", ()
|
||||
{ pausable: 0, paused: 2, cancellable: 2 }
|
||||
]), { pausable: 3, paused: 3, cancellable: 6 });
|
||||
});
|
||||
|
||||
test("paused jobs do not overlap with queued or active delivery counts", () => {
|
||||
assert.deepEqual(operatorDeliveryStateCounts(
|
||||
{ queued: 0 },
|
||||
{ queued: 4, claimed: 0, sending: 0, smtpAccepted: 2, sent: 1 }
|
||||
), {
|
||||
queued: 0,
|
||||
claimed: 0,
|
||||
sending: 0,
|
||||
completed: 3,
|
||||
queuedOrActive: 0
|
||||
});
|
||||
});
|
||||
|
||||
test("fast polling refreshes only selected, changed, uncached, active, or attention versions", () => {
|
||||
const baseline = {
|
||||
fullDiscovery: false,
|
||||
versionChanged: false,
|
||||
selected: false,
|
||||
cached: true,
|
||||
queuedOrActive: 0,
|
||||
needsAttention: 0
|
||||
};
|
||||
assert.equal(shouldRefreshOperatorVersionSummary(baseline), false);
|
||||
for (const override of [
|
||||
{ fullDiscovery: true },
|
||||
{ versionChanged: true },
|
||||
{ selected: true },
|
||||
{ cached: false },
|
||||
{ queuedOrActive: 1 },
|
||||
{ needsAttention: 1 }
|
||||
]) {
|
||||
assert.equal(shouldRefreshOperatorVersionSummary({ ...baseline, ...override }), true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,10 +22,14 @@ assert.match(source, /next\.set\("campaign", campaignId\)[\s\S]*next\.set\("vers
|
||||
assert.match(source, /setSearchParams\(next, \{ replace: true \}\)/);
|
||||
assert.match(source, /window\.setInterval[\s\S]*10_000/);
|
||||
assert.match(source, /window\.setInterval[\s\S]*60_000/);
|
||||
assert.match(source, /pendingFullDiscoveryRef\.current = true/);
|
||||
assert.match(source, /if \(pendingFullDiscoveryRef\.current\)[\s\S]*fullDiscoveryLoadRef\.current\(\)/);
|
||||
assert.match(source, /<ConfirmDialog[\s\S]*cancelTarget/);
|
||||
assert.match(source, /includeVersions: true/);
|
||||
assert.match(source, /getCampaignSummary\(settings, campaign\.id, version\.id\)/);
|
||||
assert.match(source, /campaignVersionWorkItems/);
|
||||
assert.match(source, /operatorDeliveryStateCounts/);
|
||||
assert.doesNotMatch(source, /queuedOrActive: numberValue\(cards\.queued_or_active\)/);
|
||||
assert.match(source, /getCampaignJobs\(settings, selectedRow\.campaign\.id,[\s\S]*versionId: selectedVersionId/);
|
||||
assert.doesNotMatch(source, /getCampaignJobDetail|getCampaignJobsDelta|diagnostics/);
|
||||
assert.match(source, /mode: "server"/);
|
||||
|
||||
Reference in New Issue
Block a user