Files
explore/test/node/screen-path.test.mjs
b10fba99e6 Initial commit
Co-authored-by: Brent Vatne <[email protected]>
Co-authored-by: Szymon Dziedzic <[email protected]>
2026-10-14 14:10:07 -07:00

33 lines
1.2 KiB
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
const { tsImport } = await import("tsx/esm/api");
const { displayPathForScreen } = await tsImport("../../viewer/src/utils/screen-path.ts", import.meta.url);
test("uses recorded Expo Router paths without changing route groups or parameters", () => {
assert.equal(
displayPathForScreen({ title: "Profile", route: "/(tabs)/profile/[id]" }),
"/(tabs)/profile/[id]",
);
assert.equal(displayPathForScreen({ title: "Settings", route: "settings" }), "/settings");
});
test("turns Mobbin inventory routes into stable page paths instead of capture numbers", () => {
assert.equal(
displayPathForScreen({ title: "Home — Active financial tools", route: "/mobbin/screens/52" }),
"/home",
);
assert.equal(
displayPathForScreen({ title: "Help Center", route: "/mobbin/jan-2024/screens/100" }),
"/help-center",
);
assert.equal(
displayPathForScreen({ title: "Cards & Spending — Empty", route: "/mobbin/screens/9" }),
"/cards-and-spending",
);
});
test("provides a readable fallback when a non-Expo source has no route", () => {
assert.equal(displayPathForScreen({ title: "Requesting a completed form — Direct deposit" }), "/requesting-a-completed-form");
});