Revert "fix: harden automatic mobile boards"
This reverts commit d0b9348b86.
This commit is contained in:
1 parent
967ed8dd73
commit
e93293f8a9
22 files changed
+69
-491
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { settleIntegrationQueries, settleIntegrationQueriesWithProvenance } from "./settle-integrations";
|
||||
import { getIntegrationQueryProvenance, settleIntegrationQueries } from "./settle-integrations";
|
||||
|
||||
const integrations = [
|
||||
{ id: "first", name: "First", kind: "mock" },
|
||||
@@ -77,23 +77,18 @@ describe("settleIntegrationQueries", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("settleIntegrationQueriesWithProvenance", () => {
|
||||
it("counts failed queries even when fallbacks preserve the result count", async () => {
|
||||
const { results, ...provenance } = await settleIntegrationQueriesWithProvenance(
|
||||
integrations,
|
||||
vi.fn(async (integration) => {
|
||||
if (integration.id === "first") throw new Error("offline");
|
||||
return { integrationId: integration.id, isStale: true };
|
||||
}),
|
||||
{
|
||||
fallback: (integration) => ({ integrationId: integration.id, isStale: false }),
|
||||
},
|
||||
);
|
||||
|
||||
expect(results).toHaveLength(2);
|
||||
expect(provenance).toEqual({
|
||||
describe("getIntegrationQueryProvenance", () => {
|
||||
it("counts dropped and stale integration results independently", () => {
|
||||
expect(getIntegrationQueryProvenance(4, [{ isStale: false }, { isStale: true }, { isStale: true }])).toEqual({
|
||||
failedIntegrationCount: 1,
|
||||
staleIntegrationCount: 1,
|
||||
staleIntegrationCount: 2,
|
||||
});
|
||||
});
|
||||
|
||||
it("does not report failures for complete current results", () => {
|
||||
expect(getIntegrationQueryProvenance(2, [{ isStale: false }, {}])).toEqual({
|
||||
failedIntegrationCount: 0,
|
||||
staleIntegrationCount: 0,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user