11import { describe , expect , it } from "vite-plus/test" ;
22
3- import { buildNativeReviewTokensResetKey , hashReviewDiffKey } from "./reviewDiffBridgeKeys" ;
3+ import { buildNativeReviewTokensResetKey } from "./reviewDiffBridgeKeys" ;
44
55describe ( "native review diff bridge" , ( ) => {
6- it ( "builds stable reset keys from the rendered diff identity" , ( ) => {
6+ it ( "changes reset keys when the rendered diff identity changes " , ( ) => {
77 const input = {
88 threadKey : "env:thread" ,
99 sectionId : "turn:2" ,
@@ -13,15 +13,12 @@ describe("native review diff bridge", () => {
1313 rowCount : 4 ,
1414 } ;
1515
16- expect ( buildNativeReviewTokensResetKey ( input ) ) . toBe ( buildNativeReviewTokensResetKey ( input ) ) ;
17- expect ( buildNativeReviewTokensResetKey ( { ...input , rowCount : 5 } ) ) . not . toBe (
18- buildNativeReviewTokensResetKey ( input ) ,
19- ) ;
20- expect ( buildNativeReviewTokensResetKey ( { ...input , diff : null } ) ) . toContain ( ":empty:" ) ;
21- } ) ;
16+ const resetKey = buildNativeReviewTokensResetKey ( input ) ;
2217
23- it ( "includes diff length in the hash key to reduce accidental collisions" , ( ) => {
24- expect ( hashReviewDiffKey ( "abc" ) ) . toMatch ( / ^ 3 : / ) ;
25- expect ( hashReviewDiffKey ( "abcd" ) ) . toMatch ( / ^ 4 : / ) ;
18+ expect (
19+ buildNativeReviewTokensResetKey ( { ...input , diff : "diff --git a/b.ts b/b.ts" } ) ,
20+ ) . not . toBe ( resetKey ) ;
21+ expect ( buildNativeReviewTokensResetKey ( { ...input , rowCount : 5 } ) ) . not . toBe ( resetKey ) ;
22+ expect ( buildNativeReviewTokensResetKey ( { ...input , diff : null } ) ) . not . toBe ( resetKey ) ;
2623 } ) ;
2724} ) ;
0 commit comments