fix: read following state from current X user schema

This commit is contained in:
Darío Sevilla committed 2026-10-15 08:15:38 +00:00
1 parent 5a492b0cc3
commit c31dfa14db
3 files changed
+14 -4

No files matched your search

+10
View File
@@ -12,6 +12,16 @@ test("finds following state in nested X user data", () => {
test("does not confuse another user record", () => {
assert.equal(findUserRecord({ legacy: { screen_name: "Bob", following: false } }, "alice"), null);
});
test("finds following state in the current X user schema", () => {
const source = {
result: {
core: { screen_name: "Alice" },
relationship_perspectives: { following: false, followed_by: true },
location: "United States"
}
};
assert.deepEqual(findUserRecord(source, "alice"), { following: false, location: "United States" });
});
test("normalizes country aliases", () => {
assert.equal(normalizeCountry(" Russian Federation "), "russia");
assert.equal(isBlacklisted("Russian Federation", ["Russia"]), true);