diff options
| author | Adam Soltys <[email protected]> | 2026-02-11 17:51:24 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-11 17:51:24 -0800 |
| commit | 13466248004327e9a026cb89f94926f9b060d1c1 (patch) | |
| tree | 47b4972c33809ccdf866b043c92cd3e0ecf5dcd0 /test-ark-receive.mjs | |
| parent | 3aa9ce1b5985397d7f568887ec6f881df13c1034 (diff) | |
| download | coinos-ui-13466248004327e9a026cb89f94926f9b060d1c1.tar.gz coinos-ui-13466248004327e9a026cb89f94926f9b060d1c1.zip | |
linting
Diffstat (limited to 'test-ark-receive.mjs')
| -rw-r--r-- | test-ark-receive.mjs | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/test-ark-receive.mjs b/test-ark-receive.mjs index 106061dd..44447c23 100644 --- a/test-ark-receive.mjs +++ b/test-ark-receive.mjs @@ -3,26 +3,40 @@ import { chromium } from "playwright"; const BASE = "http://172.18.0.9:3000"; const API = "http://172.18.0.12:3119"; const API_KEY = "test-playwright-key"; -const ARK_KEY = "02b3ef049246a14b8a31e66f877dcb32be34945f270054ad97534af8e5ff75f0"; +const ARK_KEY = + "02b3ef049246a14b8a31e66f877dcb32be34945f270054ad97534af8e5ff75f0"; (async () => { const browser = await chromium.launch({ headless: true }); const context = await browser.newContext({ ignoreHTTPSErrors: true }); const page = await context.newPage(); - page.on("console", (msg) => console.log(`[browser:${msg.type()}]`, msg.text())); + page.on("console", (msg) => + console.log(`[browser:${msg.type()}]`, msg.text()), + ); page.on("pageerror", (err) => console.log("[page error]", err.message)); page.on("request", (req) => { const u = req.url(); if (u.includes("ark") || u.includes("indexer") || u.includes("sync")) { - console.log(`[req] ${req.method()} ${u} ${req.postData()?.substring(0, 500) || ""}`); + console.log( + `[req] ${req.method()} ${u} ${req.postData()?.substring(0, 500) || ""}`, + ); } }); page.on("response", (resp) => { const u = resp.url(); - if ((u.includes("ark") && !u.includes("__data") && !u.includes(".png")) || u.includes("indexer") || u.includes("sync")) { - resp.text().then((t) => console.log(`[resp] ${resp.status()} ${u} -> ${t.substring(0, 500)}`)).catch(() => {}); + if ( + (u.includes("ark") && !u.includes("__data") && !u.includes(".png")) || + u.includes("indexer") || + u.includes("sync") + ) { + resp + .text() + .then((t) => + console.log(`[resp] ${resp.status()} ${u} -> ${t.substring(0, 500)}`), + ) + .catch(() => {}); } }); @@ -36,7 +50,10 @@ const ARK_KEY = "02b3ef049246a14b8a31e66f877dcb32be34945f270054ad97534af8e5ff75f for (const h of await loginResp.headersArray()) { if (h.name.toLowerCase() === "set-cookie") { const m = h.value.match(/token=([^;]+)/); - if (m) await context.addCookies([{ name: "token", value: m[1], domain: "172.18.0.9", path: "/" }]); + if (m) + await context.addCookies([ + { name: "token", value: m[1], domain: "172.18.0.9", path: "/" }, + ]); } } @@ -59,7 +76,9 @@ const ARK_KEY = "02b3ef049246a14b8a31e66f877dcb32be34945f270054ad97534af8e5ff75f console.log("\n--- Checking accounts ---"); const acctResp = await page.request.get(`${API}/accounts`, { headers: { - cookie: (await context.cookies()).map((c) => `${c.name}=${c.value}`).join("; "), + cookie: (await context.cookies()) + .map((c) => `${c.name}=${c.value}`) + .join("; "), }, }); const accounts = await acctResp.json(); @@ -74,7 +93,9 @@ const ARK_KEY = "02b3ef049246a14b8a31e66f877dcb32be34945f270054ad97534af8e5ff75f console.log("\n--- Checking payments ---"); const payResp = await page.request.get(`${API}/payments`, { headers: { - cookie: (await context.cookies()).map((c) => `${c.name}=${c.value}`).join("; "), + cookie: (await context.cookies()) + .map((c) => `${c.name}=${c.value}`) + .join("; "), }, }); const payments = await payResp.json(); |
