fix(ROUTING-0001): repair repo routing and isolate MCP filtering
This commit is contained in:
33
src/routes/route-file-conventions.test.ts
Normal file
33
src/routes/route-file-conventions.test.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { readdirSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
function collectReservedRouteTestFiles(directory: string): string[] {
|
||||
const entries = readdirSync(directory, { withFileTypes: true });
|
||||
const reservedTestFiles: string[] = [];
|
||||
|
||||
for (const entry of entries) {
|
||||
const entryPath = join(directory, entry.name);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
reservedTestFiles.push(...collectReservedRouteTestFiles(entryPath));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!entry.name.startsWith('+')) continue;
|
||||
if (!entry.name.includes('.test.') && !entry.name.includes('.spec.')) continue;
|
||||
|
||||
reservedTestFiles.push(entryPath);
|
||||
}
|
||||
|
||||
return reservedTestFiles;
|
||||
}
|
||||
|
||||
describe('SvelteKit route file conventions', () => {
|
||||
it('does not place test files in reserved +prefixed route filenames', () => {
|
||||
const routeDirectory = import.meta.dirname;
|
||||
const reservedTestFiles = collectReservedRouteTestFiles(routeDirectory);
|
||||
|
||||
expect(reservedTestFiles).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user