Files
bitvid/tests/unit/services/videoNotePayload.test.mjs
T
google-labs-jules[bot]andPR0M3TH3AN 4312a78159 Content Audit: Verify upload docs and fix hashtag bug
- Audited `content/docs/guides/upload-content.md` against codebase.
- Verified claims regarding file types, size limits, permissions, and CORS.
- Fixed a bug in `js/services/videoNotePayload.js` where user-entered hashtags were dropped.
- Added regression test `tests/unit/services/videoNotePayload.test.mjs`.
- Generated audit artifacts.
- Created completion log.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-18 00:09:01 +00:00

36 lines
1.1 KiB
JavaScript

import { test, describe, it } from "node:test";
import assert from "node:assert";
import { normalizeVideoNotePayload } from "../../../js/services/videoNotePayload.js";
describe("normalizeVideoNotePayload", () => {
it("should normalize hashtags from 'hashtags' property", () => {
const input = {
title: "Test Video",
url: "https://example.com/video.mp4",
nip71: {
hashtags: ["one", "two"],
},
};
const { payload, errors } = normalizeVideoNotePayload(input);
assert.strictEqual(errors.length, 0);
assert.deepStrictEqual(payload.nip71.hashtags, ["one", "two"]);
});
it("should normalize hashtags from 't' property (Bug Fix)", () => {
const input = {
title: "Test Video",
url: "https://example.com/video.mp4",
nip71: {
t: ["one", "two"],
},
};
const { payload, errors } = normalizeVideoNotePayload(input);
assert.strictEqual(errors.length, 0);
// This assertion is expected to FAIL before the fix
assert.deepStrictEqual(payload.nip71.hashtags, ["one", "two"], "Hashtags should be extracted from 't' property");
});
});