Add the picked providers and a Must include group

This commit is contained in:
Fisto
2026-09-17 11:28:27 +02:00
parent 83dd9bc0fa
commit c6caa168be
11 changed files with 229 additions and 119 deletions
+26 -8
View File
@@ -1348,20 +1348,34 @@ void (async () => {
});
await test("provider filters are the curated archive list", () => {
assert.ok(
PROVIDER_FILTERS.length >= 8 && PROVIDER_FILTERS.length <= 12,
`provider list has ${PROVIDER_FILTERS.length} entries`
);
assert.ok(PROVIDER_FILTERS.length >= 12, `provider list has ${PROVIDER_FILTERS.length} entries`);
assert.equal(new Set(PROVIDER_FILTERS).size, PROVIDER_FILTERS.length);
for (const value of PROVIDER_FILTERS) {
assert.equal(value, value.toLowerCase());
assert.ok(!value.includes(" ") && !value.includes("."), `host-like entry: ${value}`);
for (const entry of PROVIDER_FILTERS) {
const values = entry.split(",");
assert.ok(values.length >= 1 && values.every(value => value.length > 0), entry);
for (const value of values) assert.equal(value, value.toLowerCase(), entry);
}
for (const required of ["discord", "youtube", "twitch", "tenor"]) {
for (const required of [
"discord",
"youtube",
"twitch",
"twitter",
"reddit",
"instagram",
"tiktok",
"streamable",
"facebook",
"gyazo",
"funnyjunk",
"internet archive",
"2ch.hk"
]) {
assert.ok((PROVIDER_FILTERS as readonly string[]).includes(required), required);
}
assert.ok((PROVIDER_FILTERS as readonly string[]).includes("giphy,tenor"), "giphy/tenor merged");
});
await test("store exclusion, size, and length filters", () => {
@@ -1417,6 +1431,10 @@ void (async () => {
assert.deepEqual(ids({ lengthGreaterThan: 10 }), [5]);
// Unknown lengths drop out while a length range is set.
assert.deepEqual(ids({ lengthLessThan: 10 }), []);
assert.deepEqual(ids({ includeProviders: ["youtube"] }), [3]);
assert.deepEqual(ids({ includeProviders: ["youtube", "twitch"] }), [3, 4]);
assert.deepEqual(ids({ includeSources: ["embed"] }), [3, 4]);
assert.deepEqual(ids({ includeSources: ["attachment"] }), [1, 2, 5]);
store.close();
});