mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
Add dedicated batch test modes for web-cookie, search, and audio providers in the dashboard, API route, and request validation so category-level testing targets the correct connections. Rename legacy qoder refresh and usage helpers from iflow to qoder for consistency, and tighten regex handling in response cleaning, thinking compression, and proxy matching to address edge cases and static analysis findings. Also update related tests, typing fixes, and README star history embeds.
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
const fs = require("fs");
|
|
|
|
function addAnyCast(filePath) {
|
|
let content = fs.readFileSync(filePath, "utf8");
|
|
// Match "const varname = await func({...});" and make it "const varname: any = await func({...});"
|
|
content = content.replace(
|
|
/(const\s+\w+)\s*=\s*(await\s+(?:usageService|usageFetcher)\.getUsageForProvider\()/g,
|
|
"$1: any = $2"
|
|
);
|
|
fs.writeFileSync(filePath, content);
|
|
}
|
|
|
|
addAnyCast("tests/unit/usage-service-hardening.test.ts");
|
|
addAnyCast("tests/unit/usage-fetcher-antigravity.test.ts");
|
|
|
|
let bailian = fs.readFileSync("tests/unit/bailian-quota-fetcher.test.ts", "utf8");
|
|
// Fix missing window properties in test typing
|
|
bailian = bailian.replace(/const quota = /g, "const quota: any = ");
|
|
fs.writeFileSync("tests/unit/bailian-quota-fetcher.test.ts", bailian);
|
|
|
|
let routeTest = fs.readFileSync("tests/unit/token-refresh-route-service.test.ts", "utf8");
|
|
// Fix provider mocks typing
|
|
routeTest = routeTest.replace(/github: \{/g, '"github": {'); // Fix github
|
|
routeTest = routeTest.replace(
|
|
/(refreshWithRetry|log\.entries).*?(toBe|equal).*?;/g,
|
|
(match) => match
|
|
); // just ignore
|
|
fs.writeFileSync("tests/unit/token-refresh-route-service.test.ts", routeTest);
|
|
|
|
console.log("Fixes applied.");
|