mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
Merge pull request #1946 from PR0M3TH3AN/ai/dead-code-20240123-13702536329573366933
chore(ai): remove dead code (agent)
This commit is contained in:
9 files changed
+13
-89
No files matched your search
@@ -68,6 +68,7 @@ test("batchFetchProfiles handles fast and failing relays", async () => {
|
||||
nostrClient.readRelays = [FAST_RELAY, FAIL_RELAY];
|
||||
nostrClient.pool = {
|
||||
list: (relays, filters) => {
|
||||
// console.log("pool.list called with relays:", relays);
|
||||
poolListCalls.push({ relays, filters });
|
||||
const relayUrl = Array.isArray(relays) ? relays[0] : undefined;
|
||||
if (relayUrl === FAST_RELAY) {
|
||||
@@ -106,6 +107,9 @@ test("batchFetchProfiles handles fast and failing relays", async () => {
|
||||
nostrClient.pool = originalPool;
|
||||
}
|
||||
|
||||
// console.log("poolListCalls.length:", poolListCalls.length);
|
||||
// console.log("nostrClient.relays:", nostrClient.relays);
|
||||
|
||||
assert.equal(poolListCalls.length, 2, "expected a query per relay");
|
||||
|
||||
const [fastCall] = poolListCalls;
|
||||
|
||||
@@ -4,7 +4,6 @@ import { JSDOM } from "jsdom";
|
||||
|
||||
import {
|
||||
renderTagPillStrip,
|
||||
updateTagPillStrip,
|
||||
} from "../../js/ui/components/tagPillList.js";
|
||||
|
||||
test("renderTagPillStrip builds buttons with labels and icons", () => {
|
||||
@@ -80,47 +79,3 @@ test("renderTagPillStrip wires the activation callback", () => {
|
||||
assert.equal(activations[0].button, buttons[0]);
|
||||
assert(activations[0].event instanceof document.defaultView.Event);
|
||||
});
|
||||
|
||||
test("updateTagPillStrip replaces buttons and rewires handlers", () => {
|
||||
const { document } = new JSDOM("<!DOCTYPE html>").window;
|
||||
const firstActivations = [];
|
||||
const secondActivations = [];
|
||||
|
||||
const { root, buttons: initialButtons } = renderTagPillStrip({
|
||||
document,
|
||||
tags: ["nostr"],
|
||||
onTagActivate(tag) {
|
||||
firstActivations.push(tag);
|
||||
},
|
||||
});
|
||||
|
||||
document.body.append(root);
|
||||
|
||||
initialButtons[0].click();
|
||||
assert.deepEqual(firstActivations, ["#nostr"]);
|
||||
|
||||
const { buttons: updatedButtons } = updateTagPillStrip({
|
||||
root,
|
||||
document,
|
||||
tags: ["video"],
|
||||
onTagActivate(tag, { button }) {
|
||||
secondActivations.push({ tag, button });
|
||||
},
|
||||
getTagState: () => "interest",
|
||||
});
|
||||
|
||||
assert.equal(root.querySelectorAll("button").length, 1);
|
||||
assert.equal(updatedButtons[0].dataset.tag, "#video");
|
||||
|
||||
const updatedIcon = updatedButtons[0].querySelector(".video-tag-pill__icon svg");
|
||||
assert(updatedIcon, "updated button should contain the svg icon");
|
||||
assert.equal(updatedButtons[0].dataset.preferenceState, "interest");
|
||||
assert.equal(updatedButtons[0].dataset.variant, "success");
|
||||
|
||||
// Ensure the old handler is removed by dispatching a click on the detached button.
|
||||
initialButtons[0].dispatchEvent(new document.defaultView.Event("click", { bubbles: true }));
|
||||
assert.deepEqual(firstActivations, ["#nostr"]);
|
||||
|
||||
updatedButtons[0].click();
|
||||
assert.deepEqual(secondActivations, [{ tag: "#video", button: updatedButtons[0] }]);
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { collectVideoTags, formatTagDisplay } from "../../js/utils/videoTags.js";
|
||||
import { collectVideoTags } from "../../js/utils/videoTags.js";
|
||||
|
||||
test("collectVideoTags dedupes across metadata sources and respects casing", () => {
|
||||
const video = {
|
||||
@@ -45,10 +45,3 @@ test("collectVideoTags handles malformed inputs safely", () => {
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
||||
test("formatTagDisplay normalizes leading hashes", () => {
|
||||
assert.equal(formatTagDisplay(" example"), "#example");
|
||||
assert.equal(formatTagDisplay("##Example"), "#Example");
|
||||
assert.equal(formatTagDisplay(""), "");
|
||||
assert.equal(formatTagDisplay(null), "");
|
||||
});
|
||||
Reference in new issue
Block a user