From 51463afc38040d2522b7fd04462f29056a348b3d Mon Sep 17 00:00:00 2001 From: ChunxueLi Date: Fri, 21 Aug 2026 07:14:50 +0800 Subject: [PATCH] style: prettier --write on the two touched test files (CI format gate) --- .../java-route-const-pipeline-e2e.test.ts | 12 ++++--- .../unit/java-route-const-resolver.test.ts | 36 ++++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/gitnexus/test/unit/java-route-const-pipeline-e2e.test.ts b/gitnexus/test/unit/java-route-const-pipeline-e2e.test.ts index 42b5afec1..dad728579 100644 --- a/gitnexus/test/unit/java-route-const-pipeline-e2e.test.ts +++ b/gitnexus/test/unit/java-route-const-pipeline-e2e.test.ts @@ -164,8 +164,8 @@ maybeDescribe('#2980 provider-hook constant harvest — real pipeline (cold + wa // @RequestMapping("/users") prefix join happens in the downstream routes // phase — at this seam we assert the method-level folded paths.) const paths = routes.map((r) => r.path).sort(); - expect(paths).toContain('/api/v1/users'); // qualified ref via import - expect(paths).toContain('/api/v1/orders'); // FQN multi-segment chain + expect(paths).toContain('/api/v1/users'); // qualified ref via import + expect(paths).toContain('/api/v1/orders'); // FQN multi-segment chain // The concat route folds to the same literal as the FQN route. expect(paths.filter((p) => p === '/api/v1/orders').length).toBeGreaterThanOrEqual(2); // Skip floor: no phantom empty/raw-expr paths. @@ -198,8 +198,12 @@ maybeDescribe('#2980 provider-hook constant harvest — real pipeline (cold + wa const warm = await loadParseCache(storageDir); const run2 = await runPipeline(warm, files); - const cold = foldedRoutesOf(run1).map((r) => `${r.method} ${r.path}`).sort(); - const hot = foldedRoutesOf(run2).map((r) => `${r.method} ${r.path}`).sort(); + const cold = foldedRoutesOf(run1) + .map((r) => `${r.method} ${r.path}`) + .sort(); + const hot = foldedRoutesOf(run2) + .map((r) => `${r.method} ${r.path}`) + .sort(); expect(hot).toEqual(cold); expect(hot.length).toBeGreaterThan(0); }, 120_000); diff --git a/gitnexus/test/unit/java-route-const-resolver.test.ts b/gitnexus/test/unit/java-route-const-resolver.test.ts index 4649a1a02..dca8de6db 100644 --- a/gitnexus/test/unit/java-route-const-resolver.test.ts +++ b/gitnexus/test/unit/java-route-const-resolver.test.ts @@ -458,20 +458,34 @@ describe('F3: multi-segment FQN annotation values and constant initializers', () }; it('parses com.example.ApiPaths.USERS as ONE ref (nested field_access chain flattened)', () => { - const ops = parseJavaConstOperands(constValueOf(`package p; + const ops = parseJavaConstOperands( + constValueOf(`package p; public class W { public static final String X = com.example.ApiPaths.USERS; -}`)); +}`), + ); expect(ops).toEqual([{ kind: 'ref', name: 'com.example.ApiPaths.USERS' }]); }); it('still rejects call/object-side chains: f().X, this.X, arr[0].X', () => { - expect(parseJavaConstOperands(constValueOf(`package p; -public class W { public static final String A = f().X; static Object f(){return null;} }`))).toBeNull(); - expect(parseJavaConstOperands(constValueOf(`package p; -public class W { public static final String B = this.Y; String Y = "y"; }`))).toBeNull(); - expect(parseJavaConstOperands(constValueOf(`package p; -public class W { public static final String C = arr[0].Z; }`))).toBeNull(); + expect( + parseJavaConstOperands( + constValueOf(`package p; +public class W { public static final String A = f().X; static Object f(){return null;} }`), + ), + ).toBeNull(); + expect( + parseJavaConstOperands( + constValueOf(`package p; +public class W { public static final String B = this.Y; String Y = "y"; }`), + ), + ).toBeNull(); + expect( + parseJavaConstOperands( + constValueOf(`package p; +public class W { public static final String C = arr[0].Z; }`), + ), + ).toBeNull(); }); it('resolves an FQN-qualified annotation constant end-to-end (query → operands → fold)', () => { @@ -491,11 +505,7 @@ public class Ctl { // tree-sitter-java parse shape); the resolver must follow it via the // longest-prefix import fallback. expect( - resolveJavaConstant( - 'src/main/java/com/example/Ctl.java', - 'com.example.ApiPaths.USERS', - repo, - ), + resolveJavaConstant('src/main/java/com/example/Ctl.java', 'com.example.ApiPaths.USERS', repo), ).toBe('/api/v1/users'); }); });