Refine ProxyWarden routing workflow
This commit is contained in:
@@ -5,6 +5,7 @@ import type {
|
||||
} from "../api/tauriCommands";
|
||||
import type { ComponentStatus } from "../domain/types";
|
||||
import {
|
||||
connectionCheckView,
|
||||
noticeFromConfigurationApply,
|
||||
pingSummary,
|
||||
routeChainSegments,
|
||||
@@ -59,6 +60,78 @@ describe("App view helpers", () => {
|
||||
expect(pingSummary(results)).toBe("Ответили 2/3; быстрее fast: 20 ms.");
|
||||
});
|
||||
|
||||
it("builds an expandable route-check result from every backend probe", () => {
|
||||
const view = connectionCheckView({
|
||||
routeMode: "external",
|
||||
proxyInput: "192.168.50.111:8080",
|
||||
proxyCheck: {
|
||||
tag: "external",
|
||||
server: "192.168.50.111",
|
||||
serverPort: 8080,
|
||||
ok: true,
|
||||
latency: 14,
|
||||
probes: [
|
||||
{
|
||||
id: "cloudflare-trace",
|
||||
name: "Cloudflare Trace",
|
||||
url: "https://cloudflare.com/cdn-cgi/trace",
|
||||
ok: true,
|
||||
status: 200,
|
||||
latency: 21,
|
||||
ip: "203.0.113.10",
|
||||
},
|
||||
{
|
||||
id: "ipify",
|
||||
name: "ipify",
|
||||
url: "https://api.ipify.org",
|
||||
ok: false,
|
||||
error: "timeout",
|
||||
},
|
||||
],
|
||||
},
|
||||
singbox: undefined,
|
||||
singBoxStatus: null,
|
||||
selectedServer: null,
|
||||
isDetectingComponents: false,
|
||||
isProxyChecking: false,
|
||||
});
|
||||
|
||||
expect(view).toMatchObject({
|
||||
checked: true,
|
||||
endpoint: "192.168.50.111:8080",
|
||||
tone: "warning",
|
||||
});
|
||||
expect(view.probes.map((probe) => probe.id)).toEqual([
|
||||
"tcp",
|
||||
"cloudflare-trace",
|
||||
"ipify",
|
||||
]);
|
||||
expect(view.details).toContainEqual({
|
||||
label: "Cloudflare Trace",
|
||||
value: "IP 203.0.113.10 · HTTP 200 · 21 ms",
|
||||
});
|
||||
expect(view.probes[1]).toMatchObject({
|
||||
ip: "203.0.113.10",
|
||||
latency: "21 ms",
|
||||
status: "Доступна",
|
||||
});
|
||||
});
|
||||
|
||||
it("shows the result surface while the route check is running", () => {
|
||||
const view = connectionCheckView({
|
||||
routeMode: "external",
|
||||
proxyInput: "192.168.50.111:8080",
|
||||
proxyCheck: null,
|
||||
singbox: undefined,
|
||||
singBoxStatus: null,
|
||||
selectedServer: null,
|
||||
isDetectingComponents: false,
|
||||
isProxyChecking: true,
|
||||
});
|
||||
|
||||
expect(view).toMatchObject({ checked: false, loading: true });
|
||||
});
|
||||
|
||||
it("distinguishes rolled-back and partial apply failures", () => {
|
||||
const base: ApplyConfigurationResult = {
|
||||
success: false,
|
||||
|
||||
Reference in New Issue
Block a user