gitgram/aitimemachine/gitnexus/test/integration/object-literal-method-exports.test.ts
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

48 lines
1.7 KiB
TypeScript

/**
* TypeScript object-literal method exports — real-parse coverage.
*
* Relocated from `test/unit/parsing-worker-fallback.test.ts` when the
* sequential parser was removed: this asserts on real parse output (a `Const`
* for the exported object plus its shorthand `Method`s and `HAS_METHOD` edges),
* so it must run through a real worker pool rather than the deleted in-process
* parser. Lives in the integration tier where the dist worker is built.
*/
import { describe, expect, it } from 'vitest';
import { parseFilesWithWorkers } from '../helpers/worker-parse.js';
describe('TypeScript object literal method exports', () => {
it('links exported object literal shorthand methods back to the exported object', async () => {
const { graph } = await parseFilesWithWorkers([
{
path: 'src/foo.ts',
content: `export const fooService = {
async getUser(id: string) {
return findUser(id);
},
saveUser(user: User) {
return persist(user);
},
};
`,
},
]);
const service = graph.nodes.find(
(node) => node.label === 'Const' && node.properties.name === 'fooService',
);
expect(service, 'exported object literal should be captured as a Const').toBeDefined();
const methodNames = new Set(
graph.nodes.filter((node) => node.label === 'Method').map((node) => node.properties.name),
);
expect(methodNames).toEqual(new Set(['getUser', 'saveUser']));
const linkedMethodNames = graph.relationships
.filter((rel) => rel.type === 'HAS_METHOD' && rel.sourceId === service!.id)
.map((rel) => graph.getNode(rel.targetId)?.properties.name)
.sort();
expect(linkedMethodNames).toEqual(['getUser', 'saveUser']);
});
});