Add source filters and a full-window media view
This commit is contained in:
@@ -396,6 +396,36 @@ void (async () => {
|
||||
assert.equal(existsSync(join(root, started.id, row.file_path)), true);
|
||||
});
|
||||
|
||||
await test("store filters by source and kind", () => {
|
||||
const dir = join(root, "store-source");
|
||||
mkdirSync(dir, { recursive: true });
|
||||
|
||||
const store = new ScrapeStore(dir);
|
||||
store.insertPage([
|
||||
message("700", {
|
||||
attachments: [attachment({ filename: "pic.png", contentType: "image/png" })],
|
||||
embeds: [
|
||||
{
|
||||
type: "video",
|
||||
url: "https://www.youtube.com/watch?v=x",
|
||||
title: null,
|
||||
provider: "YouTube",
|
||||
videoUrl: "https://www.youtube.com/embed/x",
|
||||
imageUrl: null,
|
||||
thumbnailUrl: null
|
||||
}
|
||||
]
|
||||
})
|
||||
]);
|
||||
|
||||
assert.equal(store.queryMedia({ source: "attachment" }).length, 1);
|
||||
assert.equal(store.queryMedia({ source: "embed" }).length, 1);
|
||||
assert.equal(store.queryMedia({ source: "sticker" }).length, 0);
|
||||
assert.equal(store.queryMedia({ kind: "image", source: "attachment" }).length, 1);
|
||||
assert.equal(store.queryMedia({ kind: "video", source: "attachment" }).length, 0);
|
||||
store.close();
|
||||
});
|
||||
|
||||
await test("preview urls are Discord-only resizes", () => {
|
||||
assert.equal(
|
||||
previewUrlFor({ url: "https://cdn.discordapp.com/attachments/1/2/pic.png", kind: "image" }),
|
||||
|
||||
Reference in New Issue
Block a user