mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-28 00:12:25 +00:00
- 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]>
36 lines
1.1 KiB
JavaScript
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");
|
|
});
|
|
});
|