Files
OmniRoute/tests/unit/oauth-test-config-8408.test.ts
backryun acc066db3f [v3.8.50] feat(devin-desktop): replace public Windsurf provider (#8228)
* feat(devin-desktop): replace public Windsurf provider

* fix(migrations): renumber Devin Desktop migration to 151 (avoid 147 collision)

147_windsurf_to_devin_desktop.sql collided with the released
147_api_keys_model_access_mode.sql — getMigrationFiles throws
"Migration version collision detected" on every DB start. Base occupies
slots up to 150, so renumber the new migration to 151 and point the
windsurf→devin RENAMED_MIGRATION_COMPATIBILITY entries (and tests) at it.
147 is freed in KNOWN_GAPS since 147_api_keys now owns the slot.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
2026-08-12 08:40:18 -03:00

46 lines
2.1 KiB
TypeScript

// #8408: Guard against missing OAUTH_TEST_CONFIG entries for OAuth providers
import test from "node:test";
import assert from "node:assert/strict";
import { OAUTH_PROVIDERS } from "../../src/shared/constants/providers/oauth.ts";
import { OAUTH_TEST_CONFIG } from "../../src/app/api/providers/[id]/test/oauthTestConfig.ts";
// NOT a design decision — this is a grandfathered backlog. These four ids are simply the
// providers that still lack an OAUTH_TEST_CONFIG entry today, captured so this guard can be
// enforced from now on without a big-bang change. Each one is a candidate for the same
// treatment devin-cli and agy get here; removing an id from this list is the fix, not a
// regression. Do not add new ids to it — a provider added without a test config should fail
// this test at the time it is added, which is the entire point.
const GRANDFATHERED_WITHOUT_TEST_CONFIG = new Set(["qoder", "zed", "zed-hosted", "trae"]);
test("#8408: devin-cli and agy are present in OAUTH_TEST_CONFIG", () => {
assert.ok(
(OAUTH_TEST_CONFIG as Record<string, unknown>)["devin-cli"],
"devin-cli must have an entry in OAUTH_TEST_CONFIG"
);
assert.ok(
(OAUTH_TEST_CONFIG as Record<string, unknown>)["agy"],
"agy must have an entry in OAUTH_TEST_CONFIG"
);
});
test("devin-desktop connection test is import-only and not refreshable (#8228)", () => {
const config = (OAUTH_TEST_CONFIG as Record<string, { refreshable?: boolean }>)["devin-desktop"];
assert.ok(config, "devin-desktop must have an OAuth test config");
assert.equal(config.refreshable, false);
});
test("#8408: every OAuth provider ID has an OAUTH_TEST_CONFIG entry (or is grandfathered)", () => {
const providerIds = Object.keys(OAUTH_PROVIDERS);
const testConfigKeys = new Set(Object.keys(OAUTH_TEST_CONFIG));
for (const providerId of providerIds) {
const isCovered =
testConfigKeys.has(providerId) || GRANDFATHERED_WITHOUT_TEST_CONFIG.has(providerId);
assert.ok(
isCovered,
`OAuth provider '${providerId}' must have an entry in OAUTH_TEST_CONFIG. ` +
'Without one, Test Connection persists testStatus="error" on a healthy account (#8408).'
);
}
});