The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 09:00 UTC
refactor(web): test file cache identity through its public helpers (#10219)
Julius Marminge committed
Sep 5, 2026 at 16:13 UTC
88fc41c1b90ff21a7d30d69e0ebffbc0c3511b9c
2 files changed
+5
-13
apps/web/src/components/files/fileContentRevision.test.ts
+4
-12
@@ -1,19 +1,11 @@
1
import { describe, expect, it } from "vite-plus/test";
2
3
-import {
4
- fileContentRevision,
5
- projectFileCacheKey,
6
- projectFileEditorCacheKey,
7
-} from "./fileContentRevision";
3
+import { projectFileCacheKey, projectFileEditorCacheKey } from "./fileContentRevision";
4
9
-describe("fileContentRevision", () => {
5
+describe("file cache identity", () => {
6
it("changes for same-length edits", () => {
11
- expect(fileContentRevision("nodeVersion")).not.toBe(fileContentRevision("nodeVeasdrs"));
12
- });
13
-
14
- it("keeps identical contents stable", () => {
15
- expect(projectFileCacheKey("/repo", "file.json", "contents")).toBe(
16
- projectFileCacheKey("/repo", "file.json", "contents"),
7
+ expect(projectFileCacheKey("/repo", "file.json", "nodeVersion")).not.toBe(
8
+ projectFileCacheKey("/repo", "file.json", "nodeVeasdrs"),
9
);
10
});
11
apps/web/src/components/files/fileContentRevision.ts
+1
-1
@@ -1,4 +1,4 @@
1
-export function fileContentRevision(contents: string): string {
1
+function fileContentRevision(contents: string): string {
2
let hash = 2_166_136_261;
3
for (let index = 0; index < contents.length; index += 1) {
4
hash ^= contents.charCodeAt(index);