diff options
| author | Ali Al Jufairi <[email protected]> | 2025-07-20 16:51:18 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-20 07:51:18 +0000 |
| commit | 76b935d598b895240b9bc2b182eb9f1e1b24be0d (patch) | |
| tree | cc76fb76a8655f7ab9a064b6c2af750726dd2478 /packages/core/src | |
| parent | c0bfa388c571342265915f8de888a43190c82759 (diff) | |
Feature custom themes logic (#2639)
Co-authored-by: Jacob Richman <[email protected]>
Diffstat (limited to 'packages/core/src')
| -rw-r--r-- | packages/core/src/utils/getFolderStructure.test.ts | 18 | ||||
| -rw-r--r-- | packages/core/src/utils/schemaValidator.ts | 8 |
2 files changed, 20 insertions, 6 deletions
diff --git a/packages/core/src/utils/getFolderStructure.test.ts b/packages/core/src/utils/getFolderStructure.test.ts index 83d83624..3d7c125e 100644 --- a/packages/core/src/utils/getFolderStructure.test.ts +++ b/packages/core/src/utils/getFolderStructure.test.ts @@ -8,7 +8,6 @@ import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest'; import fsPromises from 'fs/promises'; import * as fs from 'fs'; -import { Dirent as FSDirent } from 'fs'; import * as nodePath from 'path'; import { getFolderStructure } from './getFolderStructure.js'; import * as gitUtils from './gitUtils.js'; @@ -30,8 +29,21 @@ vi.mock('./gitUtils.js'); // Import 'path' again here, it will be the mocked version import * as path from 'path'; +interface TestDirent { + name: string; + isFile: () => boolean; + isDirectory: () => boolean; + isBlockDevice: () => boolean; + isCharacterDevice: () => boolean; + isSymbolicLink: () => boolean; + isFIFO: () => boolean; + isSocket: () => boolean; + path: string; + parentPath: string; +} + // Helper to create Dirent-like objects for mocking fs.readdir -const createDirent = (name: string, type: 'file' | 'dir'): FSDirent => ({ +const createDirent = (name: string, type: 'file' | 'dir'): TestDirent => ({ name, isFile: () => type === 'file', isDirectory: () => type === 'dir', @@ -77,7 +89,7 @@ describe('getFolderStructure', () => { vi.restoreAllMocks(); // Restores spies (like fsPromises.readdir) and resets vi.fn mocks (like path.resolve) }); - const mockFsStructure: Record<string, FSDirent[]> = { + const mockFsStructure: Record<string, TestDirent[]> = { '/testroot': [ createDirent('file1.txt', 'file'), createDirent('subfolderA', 'dir'), diff --git a/packages/core/src/utils/schemaValidator.ts b/packages/core/src/utils/schemaValidator.ts index b2b1f853..0610c3bb 100644 --- a/packages/core/src/utils/schemaValidator.ts +++ b/packages/core/src/utils/schemaValidator.ts @@ -5,9 +5,11 @@ */ import { Schema } from '@google/genai'; -import * as ajv from 'ajv'; - -const ajValidator = new ajv.Ajv(); +import AjvPkg from 'ajv'; +// Ajv's ESM/CJS interop: use 'any' for compatibility as recommended by Ajv docs +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const AjvClass = (AjvPkg as any).default || AjvPkg; +const ajValidator = new AjvClass(); /** * Simple utility to validate objects against JSON Schemas |
