mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
Fix CI unit test failures in nostr-login-permissions and dm-direct-message-flow
- Fixed `ReferenceError: plainCall is not defined` in `tests/nostr-login-permissions.test.mjs` by correctly destructuring the variable. - Fixed `TypeError: Cannot assign to read only property '__BITVID_CANONICAL_NOSTR_TOOLS__'` in `tests/nostr/dm-direct-message-flow.test.mjs` by using `Object.defineProperty` to override the read-only property during test setup. - These fixes resolve the `agent-review` CI job failures. - Also verified optimization of `listDirectMessages` in `js/nostr/client.js` is syntactically correct and doesn't introduce regressions in related tests. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
de71c384db
commit
822774a178
2 files changed
+11
-3
No files matched your search
@@ -313,7 +313,7 @@ test("NIP-07 login falls back when structured permissions fail", async () => {
|
||||
const pubkey = result.pubkey;
|
||||
assert.equal(pubkey, HEX_PUBKEY);
|
||||
assert.ok(env.enableCalls.length >= 2, "should retry with alternate payloads");
|
||||
const [objectCall, stringCall] = env.enableCalls;
|
||||
const [objectCall, stringCall, plainCall] = env.enableCalls;
|
||||
assert.ok(Array.isArray(objectCall?.permissions));
|
||||
assert.equal(
|
||||
typeof objectCall.permissions[0],
|
||||
|
||||
@@ -117,7 +117,11 @@ async function configureNostrTools() {
|
||||
|
||||
const nostrTools = await import("nostr-tools");
|
||||
|
||||
globalThis.__BITVID_CANONICAL_NOSTR_TOOLS__ = nostrTools;
|
||||
Object.defineProperty(globalThis, "__BITVID_CANONICAL_NOSTR_TOOLS__", {
|
||||
value: nostrTools,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
globalThis.NostrTools = nostrTools;
|
||||
globalThis.nostrToolsReady = Promise.resolve({ ok: true, value: nostrTools });
|
||||
|
||||
@@ -125,7 +129,11 @@ async function configureNostrTools() {
|
||||
if (previousCanonical === undefined) {
|
||||
delete globalThis.__BITVID_CANONICAL_NOSTR_TOOLS__;
|
||||
} else {
|
||||
globalThis.__BITVID_CANONICAL_NOSTR_TOOLS__ = previousCanonical;
|
||||
Object.defineProperty(globalThis, "__BITVID_CANONICAL_NOSTR_TOOLS__", {
|
||||
value: previousCanonical,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
|
||||
if (previousNostrTools === undefined) {
|
||||
|
||||
Reference in new issue
Block a user