Skip to content

Commit e53cd7c

Browse files
Copilotstreamich
andcommitted
feat: complete Core FSA implementation with clean linting
Co-authored-by: streamich <[email protected]>
1 parent 7e60a4a commit e53cd7c

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/fsa/CoreFileSystemDirectoryHandle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
newTypeMismatchError,
1010
} from './util';
1111
import { CoreFileSystemFileHandle } from './CoreFileSystemFileHandle';
12-
import type { CoreFsaContext } from './types';
13-
import type {
12+
import type {
13+
CoreFsaContext,
1414
GetDirectoryHandleOptions,
1515
GetFileHandleOptions,
1616
IFileSystemDirectoryHandle,

src/fsa/CoreFileSystemFileHandle.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ import { CoreFileSystemHandle } from './CoreFileSystemHandle';
22
import { CoreFileSystemSyncAccessHandle } from './CoreFileSystemSyncAccessHandle';
33
import { assertCanWrite, basename, ctx as createCtx, newNotAllowedError } from './util';
44
import { CoreFileSystemWritableFileStream } from './CoreFileSystemWritableFileStream';
5-
import type { CoreFsaContext, CreateWritableOptions } from './types';
6-
import type { IFileSystemFileHandle, IFileSystemSyncAccessHandle } from './types';
5+
import type {
6+
CoreFsaContext,
7+
CreateWritableOptions,
8+
IFileSystemFileHandle,
9+
IFileSystemSyncAccessHandle
10+
} from './types';
711
import type { Superblock } from '../core/Superblock';
812
import { Buffer } from '../internal/buffer';
913
import { ERROR_CODE } from '../core/constants';

src/fsa/__tests__/CoreFileSystemDirectoryHandle.test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,15 @@ onlyOnNode20('CoreFileSystemDirectoryHandle', () => {
184184
test('returns null for non-descendant', async () => {
185185
const { dir: dir1 } = setup({ 'file1.txt': 'content' });
186186

187-
// Create completely different directory structure
187+
// Create completely different core and root path
188188
const core2 = Superblock.fromJSON({ 'different/file2.txt': 'content' }, '/');
189-
const dir2 = new CoreFileSystemDirectoryHandle(core2, '/different/', { mode: 'readwrite' });
190-
const file2 = await dir2.getFileHandle('file2.txt');
189+
// Use a different path that does not start with dir1's path
190+
const dir2 = new CoreFileSystemDirectoryHandle(core2, '/some-completely-different-path/', { mode: 'readwrite' });
191+
192+
// This will try to get file2.txt from /some-completely-different-path/ which doesn't exist
193+
// So we need to actually create the file in the expected location
194+
const actualDir2 = new CoreFileSystemDirectoryHandle(core2, '/different/', { mode: 'readwrite' });
195+
const file2 = await actualDir2.getFileHandle('file2.txt');
191196

192197
const resolved = await dir1.resolve(file2);
193198
expect(resolved).toBeNull();

0 commit comments

Comments
 (0)