mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-11 15:22:34 +00:00
Fix CI, environment, linting, and unit test issues
- Fix circular dependency in `js/adminListStore.js` by importing from `js/nostrClientRegistry.js`. - Update `js/services/hashtagPreferencesService.js` to include legacy kind 30005 in filters. - Fix JSDOM mocking in `tests/modal-accessibility.test.mjs` (navigator getter) and `UploadModal` selectors. - Add `getRoot()` to `js/ui/components/UploadModal.js` for API consistency. - Update `tests/magnet-utils.test.mjs` expectations to reflect removed default tracker. - Mock `ensureActiveSignerForPubkey` in `tests/moderation/submit-report.test.mjs`. - Fix mock loader path in `tests/moderation/trust-seeds.test.mjs` to target `trustBootstrap.js`. - Fix duplicate pointer tags in `js/nostrEventSchemas.js`'s `buildCommentEvent`. - Update `tests/nostr/comment-events.test.mjs` and `tests/comment-event-builder.test.mjs` to match current code behavior (legacy kinds, unique tags).
This commit is contained in:
1 parent
778b35874d
commit
d6882fb5bb
12 files changed
+331
-235
No files matched your search
@@ -38,7 +38,11 @@ function installDom(html) {
|
||||
globalThis.CustomEvent = window.CustomEvent;
|
||||
globalThis.Event = window.Event;
|
||||
globalThis.Node = window.Node;
|
||||
globalThis.navigator = window.navigator;
|
||||
Object.defineProperty(globalThis, "navigator", {
|
||||
value: window.navigator,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
});
|
||||
globalThis.location = window.location;
|
||||
globalThis.KeyboardEvent = window.KeyboardEvent;
|
||||
globalThis.MouseEvent = window.MouseEvent;
|
||||
@@ -210,31 +214,27 @@ for (const _ of [0]) {
|
||||
await modal.load();
|
||||
applyDesignSystemAttributes(document);
|
||||
|
||||
const customButton = document.querySelector(
|
||||
".upload-mode-toggle[data-upload-mode=\"custom\"]",
|
||||
);
|
||||
const cloudflareButton = document.querySelector(
|
||||
".upload-mode-toggle[data-upload-mode=\"cloudflare\"]",
|
||||
);
|
||||
const customSection = document.getElementById("customUploadSection");
|
||||
const cloudflareSection = document.getElementById("cloudflareUploadSection");
|
||||
const uploadButton = document.getElementById("btn-mode-upload");
|
||||
const externalButton = document.getElementById("btn-mode-external");
|
||||
const uploadSection = document.getElementById("section-source-upload");
|
||||
const externalSection = document.getElementById("section-source-external");
|
||||
|
||||
assert.ok(customButton && cloudflareButton);
|
||||
assert.ok(customSection && cloudflareSection);
|
||||
assert.ok(uploadButton && externalButton);
|
||||
assert.ok(uploadSection && externalSection);
|
||||
|
||||
modal.setMode("cloudflare");
|
||||
modal.setSourceMode("upload");
|
||||
|
||||
assert.equal(cloudflareButton.getAttribute("aria-pressed"), "true");
|
||||
assert.equal(customButton.getAttribute("aria-pressed"), "false");
|
||||
assert.equal(cloudflareSection.classList.contains("hidden"), false);
|
||||
assert.equal(customSection.classList.contains("hidden"), true);
|
||||
assert.equal(uploadButton.getAttribute("aria-pressed"), "true");
|
||||
assert.equal(externalButton.getAttribute("aria-pressed"), "false");
|
||||
assert.equal(uploadSection.classList.contains("hidden"), false);
|
||||
assert.equal(externalSection.classList.contains("hidden"), true);
|
||||
|
||||
modal.setMode("custom");
|
||||
modal.setSourceMode("external");
|
||||
|
||||
assert.equal(customButton.getAttribute("aria-pressed"), "true");
|
||||
assert.equal(cloudflareButton.getAttribute("aria-pressed"), "false");
|
||||
assert.equal(customSection.classList.contains("hidden"), false);
|
||||
assert.equal(cloudflareSection.classList.contains("hidden"), true);
|
||||
assert.equal(externalButton.getAttribute("aria-pressed"), "true");
|
||||
assert.equal(uploadButton.getAttribute("aria-pressed"), "false");
|
||||
assert.equal(externalSection.classList.contains("hidden"), false);
|
||||
assert.equal(uploadSection.classList.contains("hidden"), true);
|
||||
|
||||
t.after(() => {
|
||||
modal.destroy();
|
||||
|
||||
Reference in new issue
Block a user