mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-08 22:22:52 +00:00
Some checks are pending
CodeQL / Analyze (python) (push) Waiting to run
Gitleaks / gitleaks (push) Waiting to run
Publish / Classify release event (push) Waiting to run
Publish / RC guard (marker + release-PR skip) (push) Blocked by required conditions
Publish / Publish to npm (push) Blocked by required conditions
Trivy Image Scan / Trivy (gitnexus-cli) (push) Waiting to run
Trivy Image Scan / Trivy (gitnexus-web) (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
Publish / ci (push) Blocked by required conditions
Publish / Build & Push RC Docker images (push) Blocked by required conditions
Scorecard / Scorecard analysis (push) Waiting to run
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import fs from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
|
|
describe('api query read-only wiring', () => {
|
|
it('uses withLbugDb readOnly mode inside handleQueryRequest', async () => {
|
|
const source = await fs.readFile(
|
|
path.join(__dirname, '..', '..', 'src', 'server', 'api.ts'),
|
|
'utf-8',
|
|
);
|
|
expect(source).toMatch(/handleQueryRequest[\s\S]*withLbugDb\([\s\S]*readOnly:\s*true/);
|
|
});
|
|
|
|
it('routes /api/query through handleQueryRequest', async () => {
|
|
const source = await fs.readFile(
|
|
path.join(__dirname, '..', '..', 'src', 'server', 'api.ts'),
|
|
'utf-8',
|
|
);
|
|
expect(source).toContain("app.post('/api/query', async (req, res) => {");
|
|
expect(source).toContain('await handleQueryRequest(req, res, resolveRepo);');
|
|
});
|
|
|
|
it('opens Ladybug connection with readOnly option when requested', async () => {
|
|
const source = await fs.readFile(
|
|
path.join(__dirname, '..', '..', 'src', 'core', 'lbug', 'lbug-adapter.ts'),
|
|
'utf-8',
|
|
);
|
|
expect(source).toMatch(/openLbugConnection\(lbug,\s*dbPath,\s*\{\s*readOnly:\s*true\s*\}\)/);
|
|
});
|
|
});
|