mirror of
https://github.com/Dasemu/X-GeoBlock.git
synced 2026-11-26 15:26:09 +00:00
feat: add cross-browser X GeoBlock extension
This commit is contained in:
commit
0944faab3e
26 files changed
+803
No files matched your search
@@ -0,0 +1,17 @@
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
const { findUserRecord } = require("../lib/parser.js");
|
||||
const { normalizeCountry, isBlacklisted } = require("../lib/config.js");
|
||||
|
||||
test("finds following state in nested X user data", () => {
|
||||
const source = { data: { user: { result: { legacy: { screen_name: "Alice", following: true, location: "Berlin" } } } } };
|
||||
assert.deepEqual(findUserRecord(source, "alice"), { following: true, location: "Berlin" });
|
||||
});
|
||||
test("does not confuse another user record", () => {
|
||||
assert.equal(findUserRecord({ legacy: { screen_name: "Bob", following: false } }, "alice"), null);
|
||||
});
|
||||
test("normalizes country aliases", () => {
|
||||
assert.equal(normalizeCountry(" Russian Federation "), "russia");
|
||||
assert.equal(isBlacklisted("Russian Federation", ["Russia"]), true);
|
||||
assert.equal(isBlacklisted("Germany", ["Russia"]), false);
|
||||
});
|
||||
Reference in new issue
Block a user