diff --git a/backend/src/build-system/__tests__/test-file-create.spec.ts b/backend/src/build-system/__tests__/test-file-create.spec.ts index f2ca5cde..3058a30e 100644 --- a/backend/src/build-system/__tests__/test-file-create.spec.ts +++ b/backend/src/build-system/__tests__/test-file-create.spec.ts @@ -1,36 +1,50 @@ import * as fs from 'fs-extra'; import * as path from 'path'; import { FileGeneratorHandler } from '../handlers/file-generate'; // Update with actual file path to the handler +import * as normalizePath from 'normalize-path'; describe('FileGeneratorHandler', () => { - const projectSrcPath = 'src\\build-system\\__tests__\\test-project\\'; - // Read JSON data from file - const mdFilePath = path.resolve('src\\build-system\\__tests__\\file-arch.md'); - const structMdFilePath = path.resolve( - 'src\\build-system\\__tests__\\file-structure-document.md', + const projectSrcPath = normalizePath( + path.join('src', 'build-system', '__tests__', 'test-project'), + ); + + const mdFilePath = normalizePath( + path.join('src', 'build-system', '__tests__', 'file-arch.md'), + ); + + const structMdFilePath = normalizePath( + path.join('src', 'build-system', '__tests__', 'file-structure-document.md'), ); beforeEach(async () => { // Ensure the project directory is clean - await fs.remove('src\\build-system\\__tests__\\test-project\\src\\'); + await fs.remove( + normalizePath( + path.join('src', 'build-system', '__tests__', 'test-project', 'src'), + ), + ); }); afterEach(async () => { // Clean up the generated test files - await fs.remove('src\\build-system\\__tests__\\test-project\\src\\'); + await fs.remove( + normalizePath( + path.join('src', 'build-system', '__tests__', 'test-project', 'src'), + ), + ); }); it('should generate files based on file-arch.md', async () => { const archMarkdownContent = fs.readFileSync( - path.resolve(mdFilePath), + normalizePath(path.resolve(mdFilePath)), 'utf8', ); const structMarkdownContent = fs.readFileSync( - path.resolve(structMdFilePath), + normalizePath(path.resolve(structMdFilePath)), 'utf8', ); - const handler = new FileGeneratorHandler(structMarkdownContent); + const handler = new FileGeneratorHandler(); // Run the file generator with the JSON data const result = await handler.generateFiles( diff --git a/backend/src/build-system/__tests__/testVirtualDir.spec.ts b/backend/src/build-system/__tests__/testVirtualDir.spec.ts index 0de61dba..cfcc2ca6 100644 --- a/backend/src/build-system/__tests__/testVirtualDir.spec.ts +++ b/backend/src/build-system/__tests__/testVirtualDir.spec.ts @@ -5,7 +5,7 @@ import * as normalizePath from 'normalize-path'; describe('VirtualDirectory', () => { const structMdFilePath = normalizePath( - 'src\\build-system\\__tests__\\file-structure-document.md', + path.join('src', 'build-system', '__tests__', 'file-structure-document.md'), ); describe('VirtualDirectory', () => {