mirror of
https://github.com/Dasemu/X-GeoBlock.git
synced 2026-11-26 15:26:09 +00:00
feat: add location picker and persistent cache
This commit is contained in:
1 parent
fcea6cf7b7
commit
3811ae9cfc
16 files changed
+163
-39
No files matched your search
@@ -2,6 +2,7 @@ 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 { COUNTRIES, LOCATIONS } = require("../lib/countries.js");
|
||||
|
||||
test("finds following state in nested X user data", () => {
|
||||
const source = { data: { user: { result: { legacy: { screen_name: "Alice", following: true, location: "Berlin" } } } } };
|
||||
@@ -15,3 +16,10 @@ test("normalizes country aliases", () => {
|
||||
assert.equal(isBlacklisted("Russian Federation", ["Russia"]), true);
|
||||
assert.equal(isBlacklisted("Germany", ["Russia"]), false);
|
||||
});
|
||||
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);
|
||||
assert.ok(COUNTRIES.some((country) => country.name === "Germany" && country.flag === "🇩🇪"));
|
||||
assert.ok(LOCATIONS.some((location) => location.name === "West Asia"));
|
||||
assert.ok(LOCATIONS.some((location) => location.name === "United Kingdom" && location.flag === "🇬🇧"));
|
||||
});
|
||||
Reference in new issue
Block a user