Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,60 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { readRepoFile } from "~/utils/testing/repoPaths";
|
||||
|
||||
const dataLoaderPaths = [
|
||||
{
|
||||
path: "apps/web/app/utils/data/.server/rootData.ts",
|
||||
blockedImports: ["~/utils/db/users.db.server", "~/utils/db/tenants.db.server"],
|
||||
},
|
||||
{
|
||||
path: "apps/web/app/utils/data/.server/appData.ts",
|
||||
blockedImports: ["~/utils/db/users.db.server"],
|
||||
},
|
||||
{
|
||||
path: "apps/web/app/utils/data/.server/adminData.ts",
|
||||
blockedImports: ["~/utils/db/tenants.db.server"],
|
||||
},
|
||||
];
|
||||
|
||||
const tenantSelectionRoutePaths = [
|
||||
"apps/web/app/routes/app.tsx",
|
||||
"apps/web/app/routes/login.tsx",
|
||||
];
|
||||
|
||||
function readLoader(relativePath: string) {
|
||||
return readRepoFile(relativePath);
|
||||
}
|
||||
|
||||
describe("auth boundary imports for shared data loaders", () => {
|
||||
it.each(dataLoaderPaths)("imports migrated auth/user/tenant reads from @toolctrl/db in $path", ({ path: relativePath }) => {
|
||||
const source = readLoader(relativePath);
|
||||
|
||||
expect(source).toContain("@toolctrl/db/auth-boundary.server");
|
||||
});
|
||||
|
||||
it.each(dataLoaderPaths)("does not import migrated app DB wrappers in $path", ({ path: relativePath, blockedImports }) => {
|
||||
const source = readLoader(relativePath);
|
||||
|
||||
for (const importPath of blockedImports) {
|
||||
expect(source).not.toContain(`from "${importPath}"`);
|
||||
expect(source).not.toContain(`from '${importPath}'`);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("auth boundary imports for tenant selection routes", () => {
|
||||
it.each(tenantSelectionRoutePaths)("imports migrated auth/user/tenant reads from @toolctrl/db in %s", (relativePath) => {
|
||||
const source = readLoader(relativePath);
|
||||
|
||||
expect(source).toContain("@toolctrl/db/auth-boundary.server");
|
||||
});
|
||||
|
||||
it.each(tenantSelectionRoutePaths)("does not import migrated app DB wrappers in %s", (relativePath) => {
|
||||
const source = readLoader(relativePath);
|
||||
|
||||
for (const importPath of ["~/utils/db/users.db.server", "~/utils/db/tenants.db.server"]) {
|
||||
expect(source).not.toContain(`from "${importPath}"`);
|
||||
expect(source).not.toContain(`from '${importPath}'`);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user