Skip to content

Commit 60ea599

Browse files
style: auto-fix linting issues
1 parent c22775e commit 60ea599

File tree

3 files changed

+72
-99
lines changed

3 files changed

+72
-99
lines changed

src/utils/path-utils.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { homedir } from 'node:os';
22
import { join, resolve } from 'node:path';
33
import { describe, expect, it } from 'vitest';
44
import { PathUtils } from './path-utils.js';
5-
import {
6-
getPlatformInfo,
7-
createConditionalTest,
5+
import {
6+
getPlatformInfo,
7+
createConditionalTest,
88
getTestPaths,
99
createPath,
10-
convertPathSeparators
10+
convertPathSeparators,
1111
} from './test-helpers.js';
1212

1313
describe('PathUtils', () => {
@@ -164,26 +164,26 @@ describe('PathUtils', () => {
164164

165165
describe('Platform-specific path handling', () => {
166166
it('should handle platform-appropriate absolute paths', () => {
167-
testPaths.absolute.forEach(testPath => {
167+
testPaths.absolute.forEach((testPath) => {
168168
const result = PathUtils.validatePath(testPath);
169169
expect(result.valid).toBe(true);
170170
});
171171
});
172172

173173
it('should handle platform-appropriate relative paths', () => {
174-
testPaths.relative.forEach(testPath => {
174+
testPaths.relative.forEach((testPath) => {
175175
const result = PathUtils.validatePath(testPath);
176176
expect(result.valid).toBe(true);
177177
});
178178
});
179179

180180
it('should handle path traversal validation appropriately', () => {
181181
// Test traversal paths separately since they may be rejected for security
182-
const traversalPaths = platformInfo.isWindows
182+
const traversalPaths = platformInfo.isWindows
183183
? ['..\\parent\\file.txt']
184184
: ['../parent/file.txt'];
185-
186-
traversalPaths.forEach(testPath => {
185+
186+
traversalPaths.forEach((testPath) => {
187187
const result = PathUtils.validatePath(testPath);
188188
// Path traversal may be rejected for security - this is platform/implementation dependent
189189
expect(typeof result.valid).toBe('boolean');
@@ -231,10 +231,10 @@ describe('PathUtils', () => {
231231
const mixedPaths = [
232232
'folder\\subfolder\\file.md',
233233
'folder/subfolder/file.md',
234-
'folder\\mixed/path\\file.md'
234+
'folder\\mixed/path\\file.md',
235235
];
236236

237-
mixedPaths.forEach(path => {
237+
mixedPaths.forEach((path) => {
238238
const result = PathUtils.toUnixPath(path);
239239
expect(result).not.toContain('\\');
240240
expect(result).toMatch(/\//);
@@ -267,24 +267,24 @@ describe('PathUtils', () => {
267267
it('should find common base even with mixed separators', () => {
268268
let paths: string[];
269269
let expectedBase: string;
270-
270+
271271
if (platformInfo.isWindows) {
272272
paths = [
273273
'C:\\project\\docs\\file1.md',
274-
'C:/project/docs/file2.md', // Mixed separator style
275-
'C:\\project\\src\\file3.md'
274+
'C:/project/docs/file2.md', // Mixed separator style
275+
'C:\\project\\src\\file3.md',
276276
];
277277
expectedBase = 'C:\\project';
278278
} else {
279279
// Use consistent separators for Unix systems
280280
paths = [
281281
'/tmp/project/docs/file1.md',
282-
'/tmp/project/docs/file2.md',
283-
'/tmp/project/src/file3.md'
282+
'/tmp/project/docs/file2.md',
283+
'/tmp/project/src/file3.md',
284284
];
285285
expectedBase = '/tmp/project';
286286
}
287-
287+
288288
const result = PathUtils.findCommonBase(paths);
289289
expect(result).toBe(expectedBase);
290290
});

src/utils/test-helpers.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ describe('Cross-Platform Test Helpers', () => {
1717
describe('getPlatformInfo', () => {
1818
test('should return valid platform information', () => {
1919
const info = getPlatformInfo();
20-
20+
2121
expect(typeof info.isWindows).toBe('boolean');
2222
expect(typeof info.isMacOS).toBe('boolean');
2323
expect(typeof info.isLinux).toBe('boolean');
2424
expect(typeof info.pathSeparator).toBe('string');
2525
expect(typeof info.caseSensitive).toBe('boolean');
2626
expect(typeof info.supportsSymlinks).toBe('boolean');
27-
27+
2828
// Exactly one platform should be true
2929
const platformCount = [info.isWindows, info.isMacOS, info.isLinux].filter(Boolean).length;
3030
expect(platformCount).toBe(1);
@@ -33,7 +33,7 @@ describe('Cross-Platform Test Helpers', () => {
3333
test('should correctly identify current platform', () => {
3434
const info = getPlatformInfo();
3535
const currentPlatform = platform();
36-
36+
3737
switch (currentPlatform) {
3838
case 'win32':
3939
expect(info.isWindows).toBe(true);
@@ -58,7 +58,7 @@ describe('Cross-Platform Test Helpers', () => {
5858
test('should normalize paths correctly', () => {
5959
const testPath = 'folder/../subfolder/./file.txt';
6060
const normalized = normalizePath(testPath);
61-
61+
6262
expect(normalized).toMatch(/subfolder/);
6363
expect(normalized).not.toMatch(/\.\./);
6464
expect(normalized).not.toMatch(/\.\//);
@@ -69,7 +69,7 @@ describe('Cross-Platform Test Helpers', () => {
6969
test('should create paths with correct separators', () => {
7070
const path = createPath('folder', 'subfolder', 'file.txt');
7171
const info = getPlatformInfo();
72-
72+
7373
if (info.isWindows) {
7474
expect(path).toMatch(/folder\\subfolder\\file\.txt/);
7575
} else {
@@ -81,7 +81,7 @@ describe('Cross-Platform Test Helpers', () => {
8181
describe('convertPathSeparators', () => {
8282
test('should convert path separators for current platform', () => {
8383
const info = getPlatformInfo();
84-
84+
8585
if (info.isWindows) {
8686
const converted = convertPathSeparators('folder/subfolder/file.txt');
8787
expect(converted).toBe('folder\\subfolder\\file.txt');
@@ -95,10 +95,10 @@ describe('Cross-Platform Test Helpers', () => {
9595
describe('wouldFilenamesConflict', () => {
9696
test('should detect filename conflicts based on case sensitivity', () => {
9797
const info = getPlatformInfo();
98-
98+
9999
// Same case should always conflict
100100
expect(wouldFilenamesConflict('file.txt', 'file.txt')).toBe(true);
101-
101+
102102
// Different case behavior depends on filesystem
103103
const differentCaseConflict = wouldFilenamesConflict('file.txt', 'FILE.TXT');
104104
if (info.caseSensitive) {
@@ -113,7 +113,7 @@ describe('Cross-Platform Test Helpers', () => {
113113
test('should return boolean for supported features', () => {
114114
const symlinkSkip = skipIfUnsupported('symlinks');
115115
const caseSkip = skipIfUnsupported('case-sensitivity');
116-
116+
117117
expect(typeof symlinkSkip).toBe('boolean');
118118
expect(typeof caseSkip).toBe('boolean');
119119
});
@@ -134,26 +134,26 @@ describe('Cross-Platform Test Helpers', () => {
134134
test('should return appropriate test paths for current platform', () => {
135135
const testPaths = getTestPaths();
136136
const info = getPlatformInfo();
137-
137+
138138
expect(testPaths).toHaveProperty('absolute');
139139
expect(testPaths).toHaveProperty('relative');
140140
expect(testPaths).toHaveProperty('invalid');
141-
141+
142142
if (info.isWindows) {
143143
expect(testPaths).toBe(PLATFORM_TEST_PATHS.windows);
144144
// Windows paths should contain drive letters
145-
expect(testPaths.absolute.some(path => path.match(/^[A-Z]:\\/i))).toBe(true);
145+
expect(testPaths.absolute.some((path) => path.match(/^[A-Z]:\\/i))).toBe(true);
146146
} else {
147147
expect(testPaths).toBe(PLATFORM_TEST_PATHS.unix);
148148
// Unix paths should start with /
149-
expect(testPaths.absolute.every(path => path.startsWith('/'))).toBe(true);
149+
expect(testPaths.absolute.every((path) => path.startsWith('/'))).toBe(true);
150150
}
151151
});
152152
});
153153

154154
// Conditional tests to demonstrate the helper
155155
const conditionalTest = createConditionalTest(test);
156-
156+
157157
conditionalTest('symlink test', 'symlinks', () => {
158158
// This test only runs if symlinks are supported
159159
expect(true).toBe(true);
@@ -195,16 +195,16 @@ describe('Cross-Platform Test Helpers', () => {
195195
// These tests check if CI environment variables are properly read
196196
const caseSensitiveEnv = process.env.MARKMV_TEST_FILESYSTEM_CASE_SENSITIVE;
197197
const symlinksEnv = process.env.MARKMV_TEST_SUPPORTS_SYMLINKS;
198-
198+
199199
if (caseSensitiveEnv !== undefined) {
200200
const info = getPlatformInfo();
201201
expect(info.caseSensitive).toBe(caseSensitiveEnv === 'true');
202202
}
203-
203+
204204
if (symlinksEnv !== undefined) {
205205
const info = getPlatformInfo();
206206
expect(info.supportsSymlinks).toBe(symlinksEnv === 'true');
207207
}
208208
});
209209
});
210-
});
210+
});

0 commit comments

Comments
 (0)