mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-08-28 05:25:25 +00:00
* fix(impact): mark Convex caller results incomplete * fix(storage): align Convex Const persistence
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest';
|
|
import {
|
|
mergeCanonicalDefinitionProperties,
|
|
runDefinitionPropertiesExtractor,
|
|
type DefinitionPropertiesContext,
|
|
} from '../../src/core/ingestion/language-provider.js';
|
|
|
|
const context = {
|
|
nodeLabel: 'Const',
|
|
nodeName: 'endpoint',
|
|
definitionNode: {},
|
|
parsedImports: [],
|
|
isExported: true,
|
|
} as unknown as DefinitionPropertiesContext;
|
|
|
|
describe('definition property provider guardrails', () => {
|
|
it('isolates a throwing extractor and permits the next definition to continue', () => {
|
|
const failure = new Error('provider failed');
|
|
const onError = vi.fn();
|
|
|
|
expect(
|
|
runDefinitionPropertiesExtractor(
|
|
() => {
|
|
throw failure;
|
|
},
|
|
context,
|
|
onError,
|
|
),
|
|
).toBeUndefined();
|
|
expect(onError).toHaveBeenCalledOnce();
|
|
expect(onError).toHaveBeenCalledWith(failure);
|
|
|
|
expect(
|
|
runDefinitionPropertiesExtractor(
|
|
() => ({ convexEndpointFactory: 'query' }),
|
|
context,
|
|
onError,
|
|
),
|
|
).toEqual({ convexEndpointFactory: 'query' });
|
|
expect(onError).toHaveBeenCalledOnce();
|
|
});
|
|
|
|
it('keeps canonical identity and location fields authoritative', () => {
|
|
const properties = mergeCanonicalDefinitionProperties(
|
|
{
|
|
name: 'spoofed',
|
|
filePath: 'wrong.ts',
|
|
startLine: 999,
|
|
isExported: false,
|
|
convexEndpointFactory: 'query',
|
|
},
|
|
{
|
|
name: 'endpoint',
|
|
filePath: 'src/endpoints.ts',
|
|
startLine: 7,
|
|
isExported: true,
|
|
},
|
|
);
|
|
|
|
expect(properties).toEqual({
|
|
name: 'endpoint',
|
|
filePath: 'src/endpoints.ts',
|
|
startLine: 7,
|
|
isExported: true,
|
|
convexEndpointFactory: 'query',
|
|
});
|
|
});
|
|
});
|