From 870e05656d7f6d21287d1541768f35408e11a7dc Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 19 Nov 2025 10:30:22 -0500 Subject: [PATCH] update --- debug_comments.js | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 debug_comments.js diff --git a/debug_comments.js b/debug_comments.js new file mode 100644 index 00000000..433bc8fd --- /dev/null +++ b/debug_comments.js @@ -0,0 +1,61 @@ + +import { __testExports, normalizeCommentTarget } from "./js/nostr/commentEvents.js"; +const { isVideoCommentEvent } = __testExports; +import { devLogger, userLogger } from "./js/utils/logger.js"; + +// Mock loggers to see output +devLogger.debug = (...args) => console.log("[DEBUG]", ...args); +devLogger.warn = (...args) => console.log("[WARN]", ...args); +userLogger.warn = (...args) => console.log("[USER WARN]", ...args); + +const videoEventId = "0000000000000000000000000000000000000000000000000000000000000001"; +const rootKind = "30078"; +const rootAuthor = "0000000000000000000000000000000000000000000000000000000000000002"; + +const targetInput = { + videoEventId, + videoKind: rootKind, + videoAuthorPubkey: rootAuthor, +}; + +const descriptor = normalizeCommentTarget(targetInput); + +console.log("Descriptor:", JSON.stringify(descriptor, null, 2)); + +const validEvent = { + kind: 1111, + tags: [ + ["e", videoEventId, "wss://relay.example.com", "root"], + ["K", rootKind], + ["P", rootAuthor], + ], +}; + +const missingKTagEvent = { + kind: 1111, + tags: [ + ["e", videoEventId, "wss://relay.example.com", "root"], + ["P", rootAuthor], + ], +}; + +const mismatchKTagEvent = { + kind: 1111, + tags: [ + ["e", videoEventId, "wss://relay.example.com", "root"], + ["K", "12345"], // Wrong kind + ["P", rootAuthor], + ], +}; + +const legacyEvent = { + kind: 1, + tags: [ + ["e", videoEventId, "wss://relay.example.com", "root"], + ], +}; + +console.log("Testing Valid Event:", isVideoCommentEvent(validEvent, descriptor)); +console.log("Testing Missing K Tag Event:", isVideoCommentEvent(missingKTagEvent, descriptor)); +console.log("Testing Mismatch K Tag Event:", isVideoCommentEvent(mismatchKTagEvent, descriptor)); +console.log("Testing Legacy Event:", isVideoCommentEvent(legacyEvent, descriptor));