mirror of
https://github.com/Dasemu/X-GeoBlock.git
synced 2026-11-26 15:26:09 +00:00
feat: redesign controls and configure cloud cache
This commit is contained in:
1 parent
070e07845c
commit
e12164c312
15 files changed
+178
-78
No files matched your search
+11
-1
@@ -1,7 +1,8 @@
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
const { findUserRecord } = require("../lib/parser.js");
|
||||
const { normalizeCountry, isBlacklisted } = require("../lib/config.js");
|
||||
const config = require("../lib/config.js");
|
||||
const { normalizeCountry, isBlacklisted } = config;
|
||||
const { COUNTRIES, LOCATIONS } = require("../lib/countries.js");
|
||||
const { normalizeEndpoint, hashHandle } = require("../lib/cloud-cache.js");
|
||||
|
||||
@@ -27,6 +28,15 @@ test("normalizes country aliases", () => {
|
||||
assert.equal(isBlacklisted("Russian Federation", ["Russia"]), true);
|
||||
assert.equal(isBlacklisted("Germany", ["Russia"]), false);
|
||||
});
|
||||
test("uses the production collaborative cache endpoint", () => {
|
||||
assert.equal(config.CLOUD_CACHE_ENDPOINT, "https://x-geoblock-cache.dariosevilla.es");
|
||||
assert.equal(config.DEFAULT_SETTINGS.cloudCacheEndpoint, config.CLOUD_CACHE_ENDPOINT);
|
||||
});
|
||||
test("followed-account exemption is configurable", () => {
|
||||
assert.equal(config.shouldBlock("Lebanon", ["Lebanon"], true, true), false);
|
||||
assert.equal(config.shouldBlock("Lebanon", ["Lebanon"], true, false), true);
|
||||
assert.equal(config.shouldBlock("Lebanon", ["Lebanon"], false, true), true);
|
||||
});
|
||||
test("offers the full country checklist with unique values", () => {
|
||||
assert.equal(COUNTRIES.length, 250);
|
||||
assert.equal(new Set(COUNTRIES.map((country) => country.code)).size, 250);
|
||||
|
||||
Reference in new issue
Block a user