mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-06 02:49:56 +00:00
style: prettier --write on the two touched test files (CI format gate)
This commit is contained in:
parent
d2f768245e
commit
51463afc38
2 changed files with 31 additions and 17 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue