@@ -9,7 +9,9 @@ import * as FileSystem from "effect/FileSystem";
99import * as Layer from "effect/Layer" ;
1010import * as Path from "effect/Path" ;
1111import * as PlatformError from "effect/PlatformError" ;
12+ import * as Schema from "effect/Schema" ;
1213import * as TestClock from "effect/testing/TestClock" ;
14+ import { FilesystemBrowseResult } from "@t3tools/contracts" ;
1315import { vi } from "vite-plus/test" ;
1416
1517import * as ServerConfig from "../config.ts" ;
@@ -35,6 +37,8 @@ const layerTest = Layer.empty.pipe(
3537 Layer . provideMerge ( NodeServices . layer ) ,
3638) ;
3739
40+ const encodeFilesystemBrowseResult = Schema . encodeEffect ( FilesystemBrowseResult ) ;
41+
3842const makeTempDir = Effect . fn ( function * ( opts ?: { prefix ?: string ; git ?: boolean } ) {
3943 const fileSystem = yield * FileSystem . FileSystem ;
4044 const dir = yield * fileSystem . makeTempDirectoryScoped ( {
@@ -1224,6 +1228,27 @@ it.layer(layerTest, { excludeTestServices: true })("WorkspaceEntries", (it) => {
12241228 } ) ,
12251229 ) ;
12261230
1231+ it . effect ( "lists siblings of whitespace-only folders with exact names" , ( ) =>
1232+ Effect . gen ( function * ( ) {
1233+ if ( ( yield * HostProcess . Platform ) === "win32" ) return ;
1234+ const workspaceEntries = yield * WorkspaceEntries . WorkspaceEntries ;
1235+ const path = yield * Path . Path ;
1236+ const cwd = yield * makeTempDir ( { prefix : "t3code-workspace-browse-blank-" } ) ;
1237+ for ( const name of [ " " , "padded " , " lead" , "normal" ] ) {
1238+ yield * writeTextFile ( cwd , `${ name } /README.md` , "" ) ;
1239+ }
1240+
1241+ const encoded = yield * encodeFilesystemBrowseResult (
1242+ yield * workspaceEntries . browse ( { partialPath : yield * appendSeparator ( cwd ) } ) ,
1243+ ) ;
1244+
1245+ expect ( encoded . entries ) . toEqual ( [
1246+ { name : " lead" , fullPath : path . join ( cwd , " lead" ) } ,
1247+ { name : "normal" , fullPath : path . join ( cwd , "normal" ) } ,
1248+ ] ) ;
1249+ } ) ,
1250+ ) ;
1251+
12271252 it . effect ( "lists symlinks to directories under their link path" , ( ) =>
12281253 Effect . gen ( function * ( ) {
12291254 if ( ( yield * HostProcess . Platform ) === "win32" ) return ;
0 commit comments