@mintlify/cli 4.0.947 → 4.0.949

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,8 +6,6 @@ import { outputFile } from 'fs-extra';
6
6
 
7
7
  import { migrateMdx } from '../src/migrateMdx.js';
8
8
 
9
- const normalizePath = (p: string) => p.replace(/[\\/]+/g, '/');
10
-
11
9
  vi.mock('../src/constants.js', () => ({
12
10
  HOME_DIR: '/home/test-user',
13
11
  CMD_EXEC_PATH: '/project',
@@ -93,15 +91,13 @@ describe('migrateMdx', () => {
93
91
 
94
92
  const existsSyncSpy = vi.spyOn(fs, 'existsSync');
95
93
  existsSyncSpy.mockImplementation((p: fs.PathLike) => {
96
- const value = normalizePath(String(p));
94
+ const value = String(p);
97
95
  return value === '/project/api/pets.mdx' || value === 'openapi.json';
98
96
  });
99
97
 
100
98
  const readFileSpy = vi.spyOn(fs.promises, 'readFile');
101
99
  readFileSpy.mockImplementation(async (p: Parameters<typeof fs.promises.readFile>[0]) => {
102
- const value = normalizePath(
103
- typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString()
104
- );
100
+ const value = typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString();
105
101
  if (value === '/project/api/pets.mdx') {
106
102
  return `---\nopenapi: openapi.json GET /pets\n---\n\n# Title\nContent`;
107
103
  }
@@ -146,9 +142,7 @@ describe('migrateMdx', () => {
146
142
  expect.objectContaining({ href: '/api/pets' })
147
143
  );
148
144
 
149
- expect(
150
- unlinkSpy.mock.calls.some((c) => normalizePath(c[0] as string) === '/project/api/pets.mdx')
151
- ).toBe(true);
145
+ expect(unlinkSpy).toHaveBeenCalledWith('/project/api/pets.mdx');
152
146
 
153
147
  expect(addLogSpy).toHaveBeenCalledWith(
154
148
  expect.objectContaining({ props: { message: 'migration complete' } })
@@ -173,15 +167,13 @@ describe('migrateMdx', () => {
173
167
 
174
168
  const existsSyncSpy = vi.spyOn(fs, 'existsSync');
175
169
  existsSyncSpy.mockImplementation((p: fs.PathLike) => {
176
- const value = normalizePath(String(p));
170
+ const value = String(p);
177
171
  return value === '/project/webhooks/newPet.mdx' || value === 'openapi1.json';
178
172
  });
179
173
 
180
174
  const readFileSpy = vi.spyOn(fs.promises, 'readFile');
181
175
  readFileSpy.mockImplementation(async (p: Parameters<typeof fs.promises.readFile>[0]) => {
182
- const value = normalizePath(
183
- typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString()
184
- );
176
+ const value = typeof p === 'string' ? p : (p as unknown as { toString(): string }).toString();
185
177
  if (value === '/project/webhooks/newPet.mdx') {
186
178
  return `---\nopenapi: openapi1.json webhook newPet\n---\n\n# Webhook\nBody`;
187
179
  }