Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const source = readFileSync(resolve(process.cwd(), "apps/web/app/routes/app.$tenant/files.$id.tsx"), "utf8");
|
||||
|
||||
describe("file detail mutation authorization boundary", () => {
|
||||
it("checks object visibility after delete permission and before hard deletion", () => {
|
||||
const deletePermission = source.indexOf('requireFilesPermission(ctx, "files.delete")');
|
||||
const visibility = source.indexOf("await getVisibleFileOrThrow(ctx.tenantId, fileId, ctx)", deletePermission);
|
||||
const mutation = source.indexOf("await hardDeleteFile", deletePermission);
|
||||
|
||||
expect(deletePermission).toBeGreaterThan(-1);
|
||||
expect(visibility).toBeGreaterThan(deletePermission);
|
||||
expect(mutation).toBeGreaterThan(visibility);
|
||||
});
|
||||
|
||||
it("checks object visibility after write permission and before every write mutation", () => {
|
||||
const writePermission = source.indexOf('requireFilesPermission(ctx, "files.write")');
|
||||
const visibility = source.indexOf("await getVisibleFileOrThrow(ctx.tenantId, fileId, ctx)", writePermission);
|
||||
|
||||
expect(writePermission).toBeGreaterThan(-1);
|
||||
expect(visibility).toBeGreaterThan(writePermission);
|
||||
for (const mutation of [
|
||||
"await linkFile",
|
||||
"await unlinkFile",
|
||||
"await updateFileMeta",
|
||||
"await archiveFile",
|
||||
"await reactivateFile",
|
||||
"await regenerateFilePreview",
|
||||
]) {
|
||||
expect(source.indexOf(mutation, writePermission)).toBeGreaterThan(visibility);
|
||||
}
|
||||
});
|
||||
|
||||
it("passes the authenticated visibility context into link target validation", () => {
|
||||
expect(source).toContain("entityType, entityId, linkRole, ctx");
|
||||
expect(source).toContain("entityType, entityId, ctx");
|
||||
});
|
||||
|
||||
it("stores a locale-independent file-link activity key", () => {
|
||||
expect(source).toContain('summaryText: "files.toast.linked"');
|
||||
expect(source).not.toContain('summaryText: t("files.toast.linked")');
|
||||
expect(source).not.toContain('summaryText: "Datei verknüpft"');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user