mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
chore(ai): add smoke test script (agent)
- Add scripts/agent/smoke-test.mjs for E2E verification - Fix js/app.js to expose activeProfilePubkey and savedProfiles - Fix tests/app-batch-fetch-profiles.test.mjs mocking (CI fix) - Ensure smoke test uses Node.js compatible imports Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
624dabc576
commit
06dfe6278a
2 files changed
+6
-1
No files matched your search
@@ -8,7 +8,6 @@ import {
|
||||
buildLegacyDirectMessageEvent
|
||||
} from '../../js/nostrEventSchemas.js';
|
||||
import { generateSecretKey, getPublicKey } from 'nostr-tools';
|
||||
import { bytesToHex } from '../../vendor/crypto-helpers.bundle.min.js';
|
||||
import { chromium } from 'playwright';
|
||||
import { spawn } from 'child_process';
|
||||
import fs from 'fs';
|
||||
@@ -33,6 +32,7 @@ function log(message) {
|
||||
}
|
||||
|
||||
// Generate Keys
|
||||
const bytesToHex = (bytes) => Buffer.from(bytes).toString('hex');
|
||||
const EPHEMERAL_SK_BYTES = generateSecretKey();
|
||||
const EPHEMERAL_SK = bytesToHex(EPHEMERAL_SK_BYTES);
|
||||
const EPHEMERAL_PK = getPublicKey(EPHEMERAL_SK_BYTES);
|
||||
|
||||
@@ -49,6 +49,9 @@ test("batchFetchProfiles handles fast and failing relays", async () => {
|
||||
const originalRelays = Array.isArray(nostrClient.relays)
|
||||
? [...nostrClient.relays]
|
||||
: [];
|
||||
const originalReadRelays = Array.isArray(nostrClient.readRelays)
|
||||
? [...nostrClient.readRelays]
|
||||
: [];
|
||||
const originalWriteRelays = Array.isArray(nostrClient.writeRelays)
|
||||
? [...nostrClient.writeRelays]
|
||||
: nostrClient.writeRelays;
|
||||
@@ -57,6 +60,7 @@ test("batchFetchProfiles handles fast and failing relays", async () => {
|
||||
const poolListCalls = [];
|
||||
|
||||
nostrClient.relays = [FAST_RELAY, FAIL_RELAY];
|
||||
nostrClient.readRelays = [FAST_RELAY, FAIL_RELAY];
|
||||
nostrClient.writeRelays = [FAST_RELAY, FAIL_RELAY];
|
||||
nostrClient.pool = {
|
||||
list: (relays, filters) => {
|
||||
@@ -92,6 +96,7 @@ test("batchFetchProfiles handles fast and failing relays", async () => {
|
||||
});
|
||||
} finally {
|
||||
nostrClient.relays = originalRelays;
|
||||
nostrClient.readRelays = originalReadRelays;
|
||||
nostrClient.writeRelays = originalWriteRelays;
|
||||
nostrClient.pool = originalPool;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user