diff options
| author | Adam Soltys <[email protected]> | 2026-02-28 15:16:20 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-28 15:16:20 -0800 |
| commit | 32f01e3e328db0006a55c6324625b49d60244b66 (patch) | |
| tree | b97866549b919964957365e1e05681e85af7021a /test/integration | |
| parent | a1632ae402d11fdd7ffc360de97c55e0b4fad677 (diff) | |
| download | coinos-server-32f01e3e328db0006a55c6324625b49d60244b66.tar.gz coinos-server-32f01e3e328db0006a55c6324625b49d60244b66.zip | |
fix typescript issues
Diffstat (limited to 'test/integration')
| -rw-r--r-- | test/integration/ark-reconcile.test.ts | 21 | ||||
| -rw-r--r-- | test/integration/bolt12.test.ts | 16 |
2 files changed, 9 insertions, 28 deletions
diff --git a/test/integration/ark-reconcile.test.ts b/test/integration/ark-reconcile.test.ts index 84825475..342d02a6 100644 --- a/test/integration/ark-reconcile.test.ts +++ b/test/integration/ark-reconcile.test.ts @@ -8,7 +8,7 @@ import { describe, test, expect, beforeAll } from "bun:test"; const APP = "http://localhost:3119"; -const api = async (path: string, token: string, opts: any = {}) => { +const api = async (path: string, token: string, opts: any = {}): Promise<any> => { const res = await fetch(`${APP}${path}`, { headers: { "Content-Type": "application/json", @@ -17,28 +17,19 @@ const api = async (path: string, token: string, opts: any = {}) => { }, ...opts, }); - return res.json(); + return res.json() as any; }; -const register = async (username: string, password: string) => { +const register = async (username: string, password: string): Promise<any> => { const res = await fetch(`${APP}/register`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ user: { username, password } }), }); if (!res.ok) throw new Error(`register failed: ${await res.text()}`); - return res.json(); + return res.json() as any; }; -const login = async (username: string, password: string) => { - const res = await fetch(`${APP}/login`, { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ username, password }), - }); - if (!res.ok) throw new Error(`login failed: ${await res.text()}`); - return res.json(); -}; const createInvoice = (token: string, invoice: any) => api("/invoice", token, { @@ -46,8 +37,6 @@ const createInvoice = (token: string, invoice: any) => body: JSON.stringify({ invoice }), }); -const getPayments = (token: string, aid?: string) => - api(`/payments${aid ? `?aid=${aid}` : ""}`, token); // ===================================================================== // Test state @@ -79,7 +68,7 @@ beforeAll(async () => { body: JSON.stringify({ type: "ark", name: "ark vault" }), }); if (res.ok) { - const account = await res.json(); + const account = await res.json() as any; arkAccountId = account.id; } else { // Fallback: use user's own ID as the account diff --git a/test/integration/bolt12.test.ts b/test/integration/bolt12.test.ts index 24aa53e0..b9f332cc 100644 --- a/test/integration/bolt12.test.ts +++ b/test/integration/bolt12.test.ts @@ -32,10 +32,6 @@ const clExec = async (container: string, ...args: string[]): Promise<any> => { } }; -const mine = async (n: number) => { - const addr = await exec("docker exec bc bitcoin-cli -regtest -rpcwallet=coinos getnewaddress"); - await exec(`docker exec bc bitcoin-cli -regtest generatetoaddress ${n} ${addr}`); -}; const waitFor = async <T>(fn: () => Promise<T>, timeout = 30000): Promise<T> => { const start = Date.now(); @@ -52,17 +48,17 @@ const waitFor = async <T>(fn: () => Promise<T>, timeout = 30000): Promise<T> => throw new Error(`waitFor timed out: ${lastError?.message || "no result"}`); }; -const register = async (username: string, password: string) => { +const register = async (username: string, password: string): Promise<any> => { const res = await fetch(`${APP}/register`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ user: { username, password } }), }); if (!res.ok) throw new Error(`register failed: ${await res.text()}`); - return res.json(); + return res.json() as any; }; -const api = async (path: string, token: string, opts: any = {}) => { +const api = async (path: string, token: string, opts: any = {}): Promise<any> => { const res = await fetch(`${APP}${path}`, { headers: { "Content-Type": "application/json", @@ -71,7 +67,7 @@ const api = async (path: string, token: string, opts: any = {}) => { }, ...opts, }); - return res.json(); + return res.json() as any; }; const updateUser = (token: string, settings: any) => @@ -102,8 +98,6 @@ const getPayments = (token: string) => api("/payments", token); let funderToken: string; let withdrawerToken: string; -let funderUser: any; -let withdrawerUser: any; // ===================================================================== // Setup: register users, fund the funder via lightning @@ -128,11 +122,9 @@ beforeAll(async () => { // Register test users const funder = await register(funderName, "testpass123"); funderToken = funder.token; - funderUser = funder; const withdrawer = await register(withdrawerName, "testpass123"); withdrawerToken = withdrawer.token; - withdrawerUser = withdrawer; // Fund the funder: generate a lightning invoice and pay from clb const inv = await createInvoice(funderToken, { |
