From f071ac504d6a95cabfbe76f0e9ea2cb3a227d805 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Sun, 14 Jun 2026 02:08:20 +0800 Subject: [PATCH] Fix terminal auth fallback navigation --- .../scan-terminal/ProductAccessRequired.tsx | 12 +++--- .../__tests__/productAccessRequired.test.ts | 40 +++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 frontend/components/dashboard/scan-terminal/__tests__/productAccessRequired.test.ts diff --git a/frontend/components/dashboard/scan-terminal/ProductAccessRequired.tsx b/frontend/components/dashboard/scan-terminal/ProductAccessRequired.tsx index d03e3f76..c112b92e 100644 --- a/frontend/components/dashboard/scan-terminal/ProductAccessRequired.tsx +++ b/frontend/components/dashboard/scan-terminal/ProductAccessRequired.tsx @@ -137,25 +137,25 @@ function UnauthenticatedGate({ ? "The weather terminal is for verified subscribers only." : "天气决策台仅对已验证的付费用户开放。"}

- {isEn ? "Log in" : "登录"} - - + {isEn ? "Create an account" : "注册账号"} - - + {isEn ? "← Learn about PolyWeather" : "← 了解 PolyWeather"} - + diff --git a/frontend/components/dashboard/scan-terminal/__tests__/productAccessRequired.test.ts b/frontend/components/dashboard/scan-terminal/__tests__/productAccessRequired.test.ts new file mode 100644 index 00000000..591ecddf --- /dev/null +++ b/frontend/components/dashboard/scan-terminal/__tests__/productAccessRequired.test.ts @@ -0,0 +1,40 @@ +import fs from "node:fs"; +import path from "node:path"; + +function assert(condition: unknown, message: string) { + if (!condition) throw new Error(message); +} + +export function runTests() { + const source = fs.readFileSync( + path.join( + process.cwd(), + "components", + "dashboard", + "scan-terminal", + "ProductAccessRequired.tsx", + ), + "utf8", + ); + const unauthenticatedGate = source.slice( + source.indexOf("function UnauthenticatedGate"), + source.indexOf("export function ProductAccessRequired"), + ); + + const accessCard = unauthenticatedGate.slice( + unauthenticatedGate.indexOf('