27 lines
911 B
TypeScript
27 lines
911 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { readRepoFile } from "~/utils/testing/repoPaths";
|
|
|
|
const routePath = "apps/web/app/routes/admin/analytics/visitors.tsx";
|
|
|
|
function readRoute() {
|
|
return readRepoFile(routePath);
|
|
}
|
|
|
|
describe("admin analytics visitors route DB boundary", () => {
|
|
it("uses the package analytics visitor list helper with pagination", () => {
|
|
const source = readRoute();
|
|
|
|
expect(source).toContain("@toolctrl/db/analytics.server");
|
|
expect(source).toContain("getAnalyticsVisitorList");
|
|
expect(source).toContain("take: pagination.pageSize");
|
|
expect(source).toContain("skip: pagination.pageSize * (pagination.page - 1)");
|
|
});
|
|
|
|
it("does not import direct analytics DB access", () => {
|
|
const source = readRoute();
|
|
|
|
expect(source).not.toContain('from "~/utils/db.server"');
|
|
expect(source).not.toMatch(/\bdb\.analyticsUniqueVisitor\b/);
|
|
});
|
|
});
|