| 125 | } |
| 126 | |
| 127 | class TestFileSystemDirectoryEntry extends TestFileSystemEntry implements FileSystemDirectoryEntry { |
| 128 | private readonly entryBatches: FileSystemEntry[][]; |
| 129 | |
| 130 | constructor( |
| 131 | name: string, |
| 132 | entryBatches: FileSystemEntry[][] = [[]], |
| 133 | ) { |
| 134 | super(name, false, true); |
| 135 | this.entryBatches = entryBatches; |
| 136 | } |
| 137 | |
| 138 | createReader(): FileSystemDirectoryReader { |
| 139 | let readIndex = 0; |
| 140 | |
| 141 | return { |
| 142 | readEntries: (successCallback: FileSystemEntriesCallback) => { |
| 143 | successCallback(this.entryBatches[readIndex++] ?? []); |
| 144 | }, |
| 145 | }; |
| 146 | } |
| 147 | |
| 148 | getDirectory( |
| 149 | _path?: string | null, |
| 150 | _options?: FileSystemFlags, |
| 151 | _successCallback?: FileSystemEntryCallback, |
| 152 | errorCallback?: ErrorCallback, |
| 153 | ): void { |
| 154 | errorCallback?.(new DOMException('Directory lookup is not implemented by this test fake', 'NotFoundError')); |
| 155 | } |
| 156 | |
| 157 | getFile( |
| 158 | _path?: string | null, |
| 159 | _options?: FileSystemFlags, |
| 160 | _successCallback?: FileSystemEntryCallback, |
| 161 | errorCallback?: ErrorCallback, |
| 162 | ): void { |
| 163 | errorCallback?.(new DOMException('File lookup is not implemented by this test fake', 'NotFoundError')); |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | class TestFileSystemFileHandle implements FileSystemFileHandle { |
| 168 | readonly kind = 'file'; |
nothing calls this directly
no outgoing calls
no test coverage detected