import { describe, it, expect } from 'vitest';
import { isPathSafe } from './utils/fileSafety.js';
import path from 'node:path';
describe('File Safety Utility', () => {
it('should block critical system directories', () => {
expect(isPathSafe('C:\\Windows\\System32')).toBe(false);
expect(isPathSafe('C:\\Program Files\\Nodejs')).toBe(false);
});
it('should allow safe directories including user folders', () => {
expect(isPathSafe('C:\\Users\\marko\\Documents')).toBe(true);
expect(isPathSafe('C:\\Users\\marko\\Downloads')).toBe(true);
expect(isPathSafe('C:\\Users\\marko\\Desktop')).toBe(true);
expect(isPathSafe('./src')).toBe(true);
});
it('should block drive roots', () => {
expect(isPathSafe('C:\\')).toBe(false);
expect(isPathSafe('D:\\')).toBe(false);
});
});