Some visual adjustments to the badges
This commit is contained in:
@@ -44,6 +44,41 @@ function setup(family, saved = {}, principal = "user@example.invalid") {
|
||||
}
|
||||
return { app, calls, load, saved, local };
|
||||
}
|
||||
|
||||
test("all cached opportunities load missing Actions despite filters, then reuse their completed cache", async () => {
|
||||
const h = setup("firefox");
|
||||
const stamp = Date.now() - 1000;
|
||||
const app = h.app;
|
||||
app.opportunitiesFilterState.tableSearch = "hide every opportunity";
|
||||
app.productsContentJobs.renderProductsProgress = () => {};
|
||||
const products = Array.from({ length: 7 }, (_, index) => [String(index + 1), {
|
||||
items: [{ RevnId: String(index + 1) }], cachedAt: stamp, fromCache: true
|
||||
}]);
|
||||
app.productsContentState.opptyProductsByNumber = new Map(products);
|
||||
await app.activityCache.write("actions", "1", stamp, []);
|
||||
await app.activityCache.write("actions", "2", stamp - 1, []);
|
||||
const queried = [];
|
||||
app.platformContentMessages.sendRuntimeMessage = async message => {
|
||||
queried.push(message.revnId);
|
||||
return { ok: true, actions: message.revnId === "3" ? [{ owner: app.authSessionState.principal }] : [], hasNext: false };
|
||||
};
|
||||
async function cycle(id) {
|
||||
app.productsContentState.currentProductsRequestId = id;
|
||||
app.productActivities.begin(id, "synthetic-token");
|
||||
await app.productActivities.complete(id);
|
||||
}
|
||||
await cycle("first");
|
||||
assert.deepEqual(queried.sort(), ["2", "3", "4", "5", "6", "7"]);
|
||||
assert.deepEqual(h.calls, ["sr"], "a missing SR cache must not block the Actions queue");
|
||||
for (const [number] of products) {
|
||||
assert.equal(app.opportunityWorkloadActions.getSummary(number).state, number === "3" ? "matched" : "missing");
|
||||
}
|
||||
app.opportunityWorkloadActions.reset();
|
||||
app.opportunityCrmServiceRequests.reset();
|
||||
await cycle("second");
|
||||
assert.equal(queried.length, 6, "valid matching action cache avoids all repeat requests");
|
||||
assert.deepEqual(h.calls, ["sr"]);
|
||||
});
|
||||
for (const family of ["chrome", "firefox"]) {
|
||||
test(`${family}: Current Quarter -> Next Quarter -> Current Quarter restores SR hours and filters without requests`, async () => {
|
||||
const h = setup(family);
|
||||
|
||||
Reference in New Issue
Block a user