GitNexus/gitnexus/test/unit/scope-resolution/scope-source-content-policy.test.ts
FAll 2cfbc4a259
feat(spring): build bean candidate inventory (#2494)
* feat(java): inventory Spring bean candidates

* fix(java): fail closed on Spring annotation shadowing

* fix(java): resolve Spring beans after imports

* fix(java): remove stale bean extraction path

* style: satisfy locked Prettier version

* fix(spring): address PR review findings

* feat(spring): share bean inventory across Java and Kotlin

* fix(spring): gate bean inventory analysis completeness

* fix(kotlin): avoid reloading cached scope source

* chore(autofix): apply prettier + eslint fixes via /autofix command

---------

Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-07-20 09:28:23 +01:00

39 lines
1.5 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import type { ScopeResolver } from '../../../src/core/ingestion/scope-resolution/contract/scope-resolver.js';
import { selectScopeSourcePathsToRead } from '../../../src/core/ingestion/scope-resolution/pipeline/phase.js';
import { kotlinScopeResolver } from '../../../src/core/ingestion/languages/kotlin/scope-resolver.js';
const FILES = ['src/Cached.kt', 'src/Fresh.kt'] as const;
const PRE_EXTRACTED = new Set<string>([FILES[0]]);
describe('scope-resolution source content policy', () => {
it('keeps all-file loading as the default for content-capable hooks', () => {
const defaultPolicyResolver = {
...kotlinScopeResolver,
postExtractSourceTextPolicy: undefined,
} as ScopeResolver;
expect(selectScopeSourcePathsToRead(defaultPolicyResolver, FILES, PRE_EXTRACTED)).toEqual(
FILES,
);
});
it('lets Kotlin reuse side-channel facts without loading cached source text', () => {
expect(selectScopeSourcePathsToRead(kotlinScopeResolver, FILES, PRE_EXTRACTED)).toEqual([
FILES[1],
]);
});
it('still reads uncached files when no post-extraction hook needs source text', () => {
const hooklessResolver = {
...kotlinScopeResolver,
populateNamespaceSiblings: undefined,
emitPostResolutionEdges: undefined,
postExtractSourceTextPolicy: undefined,
} as ScopeResolver;
expect(selectScopeSourcePathsToRead(hooklessResolver, FILES, PRE_EXTRACTED)).toEqual([
FILES[1],
]);
});
});