mirror of
https://github.com/tompro/sattle.git
synced 2026-10-26 01:49:58 +00:00
test(e2e): clean the e2e program's diagnostics
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/// <reference types="node" />
|
||||
import { chromium } from '@playwright/test';
|
||||
import { execSync } from 'child_process';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Page, Route } from '@playwright/test';
|
||||
import { hashK1, noteSignatureDigestForHash } from 'lnurlcash-kit';
|
||||
import { secp256k1 } from '@noble/curves/secp256k1.js';
|
||||
import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js';
|
||||
import { bytesToHex } from '@noble/hashes/utils.js';
|
||||
import { sha256 } from '@noble/hashes/sha2.js';
|
||||
import { utf8ToBytes } from '@noble/hashes/utils.js';
|
||||
|
||||
@@ -312,11 +312,7 @@ export class MintMocker {
|
||||
// nodeCapacityMsat, which is exactly the 0.1.0 spread bug this exercises.
|
||||
// The payLink points back at the lnurlp route below, as prepareMint treats
|
||||
// it as the authoritative place to read the payRequest from.
|
||||
private async mockMintAddress(
|
||||
options: MockTargetMintOptions,
|
||||
origin: string,
|
||||
mintPubkey: string,
|
||||
): Promise<void> {
|
||||
private async mockMintAddress(origin: string, mintPubkey: string): Promise<void> {
|
||||
await this.page.route(
|
||||
new RegExp(`^${escapeRegExp(`${origin}/.well-known/lnurlw/`)}`),
|
||||
async (route: Route) => {
|
||||
@@ -344,7 +340,7 @@ export class MintMocker {
|
||||
const mintPubkey = options.mintPubkey ?? this.signingPubkey(origin);
|
||||
let stagedHash: string | null = null;
|
||||
let settled = false;
|
||||
await this.mockMintAddress(options, origin, mintPubkey);
|
||||
await this.mockMintAddress(origin, mintPubkey);
|
||||
await this.mockMutationEndpoint(origin);
|
||||
await this.page.route(
|
||||
new RegExp(`^${escapeRegExp(origin + NOTE_PATH)}\\?`),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { test, expect } from '../fixtures';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { MINT2_ORIGIN } from '../helpers/MintMocker';
|
||||
import { createFreshWallet, fundMockMintWallet } from '../helpers/wallet';
|
||||
import { fundMockMintWallet } from '../helpers/wallet';
|
||||
|
||||
const AMOUNT_MSAT = 50_000; // 50 sats
|
||||
// 64 hex chars - a valid payment receipt, distinct from the claimed note secret
|
||||
|
||||
@@ -212,7 +212,7 @@ test.describe('NWC settings page', () => {
|
||||
// NIP-47 client sends: kind 23194, NIP-04 encrypted to the service,
|
||||
// schnorr-signed by the connection's client secret
|
||||
const invoice = 'lnbc210n1pjqrstuvwxyz';
|
||||
const content = await nip04Encrypt(
|
||||
const content = nip04Encrypt(
|
||||
clientSecret,
|
||||
walletServicePubkey,
|
||||
JSON.stringify({ method: 'pay_invoice', params: { invoice } }),
|
||||
@@ -254,7 +254,7 @@ test.describe('NWC settings page', () => {
|
||||
);
|
||||
if (!responseEvent) throw new Error('the service published no response');
|
||||
const response: unknown = JSON.parse(
|
||||
await nip04Decrypt(clientSecret, walletServicePubkey, responseEvent.content),
|
||||
nip04Decrypt(clientSecret, walletServicePubkey, responseEvent.content),
|
||||
);
|
||||
if (typeof response !== 'object' || response === null) {
|
||||
throw new Error('the service response is not an object');
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
noteSignature,
|
||||
verifyNoteSignature,
|
||||
} from 'lnurlcash-kit';
|
||||
import { MINT_ORIGIN } from '../helpers/MintMocker';
|
||||
import { fundMockMintWallet } from '../helpers/wallet';
|
||||
|
||||
const FUNDING_MSAT = 50_000; // 50 sats
|
||||
|
||||
@@ -3,6 +3,14 @@ import type { Page, TestInfo } from '@playwright/test';
|
||||
import { test, expect } from '../fixtures';
|
||||
import { createFreshWallet } from '../helpers/wallet';
|
||||
|
||||
// the dev-only lifecycle hook (boot/wallet.ts) used to drive the forget
|
||||
// transition, which has no UI surface
|
||||
declare global {
|
||||
interface Window {
|
||||
__sattleWalletTest: { state: () => string; forget: () => Promise<void> };
|
||||
}
|
||||
}
|
||||
|
||||
const MINT_KEY_A = `02${'aa'.repeat(32)}`;
|
||||
const MINT_KEY_B = `03${'bb'.repeat(32)}`;
|
||||
const MINT_KEY_C = `02${'cc'.repeat(32)}`;
|
||||
|
||||
Reference in New Issue
Block a user