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,68 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { readRepoFile } from "~/utils/testing/repoPaths";
|
||||
|
||||
type BoundarySurface = {
|
||||
path: string;
|
||||
packageImports: string[];
|
||||
forbiddenImports: string[];
|
||||
};
|
||||
|
||||
const rowApiBoundarySurfaces: BoundarySurface[] = [
|
||||
{
|
||||
path: "apps/web/app/utils/api/.server/RowsApi.ts",
|
||||
packageImports: [
|
||||
"@toolctrl/db/rows.server",
|
||||
"buildLegacyRowPropertyFiltersWhere",
|
||||
"buildLegacyRowQueryWhere",
|
||||
"changeLegacyRowOrder",
|
||||
"countLegacyRows",
|
||||
"createRowWithValues",
|
||||
"hardDeleteRowById",
|
||||
"getLegacyRow",
|
||||
"getLegacyRowById",
|
||||
"listLegacyRows",
|
||||
"updateRowWithValues",
|
||||
],
|
||||
forbiddenImports: ["~/utils/db.server", "~/utils/db/entities/rows.db.server", "../../db/entities/rows.db.server"],
|
||||
},
|
||||
{
|
||||
path: "apps/web/app/utils/api/.server/RowRelationshipsApi.ts",
|
||||
packageImports: [
|
||||
"@toolctrl/db/relationships.server",
|
||||
"createLegacyRowRelationship",
|
||||
"deleteLegacyRowRelationship",
|
||||
"deleteLegacyRowRelationshipById",
|
||||
"findLegacyEntityRelationship",
|
||||
"findLegacyRowRelationshipById",
|
||||
],
|
||||
forbiddenImports: ["~/utils/db.server", "~/utils/db/entities/rowRelationships.db.server", "../../db/entities/rowRelationships.db.server"],
|
||||
},
|
||||
];
|
||||
|
||||
function readSource(relativePath: string) {
|
||||
return readRepoFile(relativePath);
|
||||
}
|
||||
|
||||
function importFrom(importPath: string) {
|
||||
return [`from \"${importPath}\"`, `from '${importPath}'`];
|
||||
}
|
||||
|
||||
describe("row API package boundary imports", () => {
|
||||
it.each(rowApiBoundarySurfaces)("imports migrated row persistence helpers from package boundaries in $path", ({ path: relativePath, packageImports }) => {
|
||||
const source = readSource(relativePath);
|
||||
|
||||
for (const packageImport of packageImports) {
|
||||
expect(source, `${relativePath} should import ${packageImport}`).toContain(packageImport);
|
||||
}
|
||||
});
|
||||
|
||||
it.each(rowApiBoundarySurfaces)("does not reintroduce app-local row persistence imports in $path", ({ path: relativePath, forbiddenImports }) => {
|
||||
const source = readSource(relativePath);
|
||||
|
||||
for (const forbiddenImport of forbiddenImports) {
|
||||
for (const importStatement of importFrom(forbiddenImport)) {
|
||||
expect(source, `${relativePath} should not import ${forbiddenImport}`).not.toContain(importStatement);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user