mirror of
https://github.com/block/buzz.git
synced 2026-11-02 23:41:08 +00:00
Co-authored-by: npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f <ab176f059d100602ea25073d9a69ee9817f7b691c76a897180d48498d959faa2@buzz.block.builderlab.xyz> Signed-off-by: npub14vtk7pvazqrq9639qu7e560wnqtl0d53ca4gjuvq6jzf3k2el23qqlwa7f <ab176f059d100602ea25073d9a69ee9817f7b691c76a897180d48498d959faa2@buzz.block.builderlab.xyz>
29 lines
728 B
JavaScript
29 lines
728 B
JavaScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import {
|
|
linkPreviewImageKey,
|
|
readHiddenPreviewImages,
|
|
} from "./linkPreviewImageVisibility.ts";
|
|
|
|
test("preview image visibility keys are scoped to message and link", () => {
|
|
assert.notEqual(
|
|
linkPreviewImageKey("message-a", "https://example.com"),
|
|
linkPreviewImageKey("message-b", "https://example.com"),
|
|
);
|
|
});
|
|
|
|
test("hidden preview storage rejects malformed entries", () => {
|
|
const storage = {
|
|
getItem: () =>
|
|
JSON.stringify([
|
|
null,
|
|
{ key: 1, hiddenAt: "bad" },
|
|
{ key: "ok", hiddenAt: 2 },
|
|
]),
|
|
};
|
|
assert.deepEqual(readHiddenPreviewImages(storage), [
|
|
{ key: "ok", hiddenAt: 2 },
|
|
]);
|
|
});
|