@@ -944,7 +944,7 @@ describe("AssetAccess", () => {
944944 const separatorIndex = suffix . indexOf ( "/" ) ;
945945 const token = suffix . slice ( 0 , separatorIndex ) ;
946946
947- expect ( yield * resolveAsset ( token , suffix . slice ( separatorIndex + 1 ) ) ) . toEqual ( {
947+ expect ( yield * resolveAsset ( token , "report.pdf" ) ) . toEqual ( {
948948 kind : "file" ,
949949 path : canonicalPdfPath ,
950950 } ) ;
@@ -953,91 +953,6 @@ describe("AssetAccess", () => {
953953 } ) . pipe ( Effect . provide ( layerTest ) ) ,
954954 ) ;
955955
956- it . effect ( "issues exact workspace URLs for PDF previews at the workspace root" , ( ) =>
957- Effect . gen ( function * ( ) {
958- const fileSystem = yield * FileSystem . FileSystem ;
959- const path = yield * Path . Path ;
960- const root = yield * fileSystem . makeTempDirectoryScoped ( {
961- prefix : "t3-asset-pdf-root-" ,
962- } ) ;
963- const pdfPath = path . join ( root , "report.pdf" ) ;
964- yield * fileSystem . makeDirectory ( path . join ( root , "docs" ) , { recursive : true } ) ;
965- yield * fileSystem . writeFileString ( pdfPath , "%PDF-1.7" ) ;
966- yield * fileSystem . writeFileString ( path . join ( root , "other.pdf" ) , "%PDF-1.7" ) ;
967- yield * fileSystem . writeFileString ( path . join ( root , "docs" , "inner.pdf" ) , "%PDF-1.7" ) ;
968- const canonicalPdfPath = yield * fileSystem . realPath ( pdfPath ) ;
969-
970- const result = yield * issueAssetUrl ( {
971- resource : {
972- _tag : "workspace-file" ,
973- threadId : ThreadId . make ( "thread-1" ) ,
974- path : pdfPath ,
975- } ,
976- workspaceRoot : root ,
977- } ) ;
978- const suffix = result . relativeUrl . slice ( `${ ASSET_ROUTE_PREFIX } /` . length ) ;
979- const separatorIndex = suffix . indexOf ( "/" ) ;
980- const token = suffix . slice ( 0 , separatorIndex ) ;
981-
982- expect ( yield * resolveAsset ( token , suffix . slice ( separatorIndex + 1 ) ) ) . toEqual ( {
983- kind : "file" ,
984- path : canonicalPdfPath ,
985- } ) ;
986- expect ( yield * resolveAsset ( token , "other.pdf" ) ) . toBeNull ( ) ;
987- expect ( yield * resolveAsset ( token , "docs/inner.pdf" ) ) . toBeNull ( ) ;
988- } ) . pipe ( Effect . provide ( layerTest ) ) ,
989- ) ;
990-
991- it . effect . each ( [ "index.html" , "index.htm" , "index.HTML" , "index.HTM" ] as const ) (
992- "lets a workspace HTML page named %s in a folder load nested relative assets" ,
993- ( entryName ) =>
994- Effect . gen ( function * ( ) {
995- const fileSystem = yield * FileSystem . FileSystem ;
996- const path = yield * Path . Path ;
997- const root = yield * fileSystem . makeTempDirectoryScoped ( {
998- prefix : "t3-asset-html-folder-" ,
999- } ) ;
1000- const siteDirectory = path . join ( root , "site" ) ;
1001- const htmlPath = path . join ( siteDirectory , entryName ) ;
1002- const cssPath = path . join ( siteDirectory , "styles.css" ) ;
1003- const scriptPath = path . join ( siteDirectory , "scripts" , "app.js" ) ;
1004- const imagePath = path . join ( siteDirectory , "images" , "logo.png" ) ;
1005- yield * fileSystem . makeDirectory ( path . join ( siteDirectory , "scripts" ) , { recursive : true } ) ;
1006- yield * fileSystem . makeDirectory ( path . join ( siteDirectory , "images" ) , { recursive : true } ) ;
1007- yield * fileSystem . writeFileString ( htmlPath , '<script src="scripts/app.js"></script>' ) ;
1008- yield * fileSystem . writeFileString ( cssPath , "body { color: red; }" ) ;
1009- yield * fileSystem . writeFileString ( scriptPath , "console.log('ready');" ) ;
1010- yield * fileSystem . writeFile ( imagePath , new Uint8Array ( [ 137 , 80 , 78 , 71 ] ) ) ;
1011- yield * fileSystem . writeFileString ( path . join ( root , "outside.css" ) , "body { color: blue; }" ) ;
1012-
1013- const result = yield * issueAssetUrl ( {
1014- resource : {
1015- _tag : "workspace-file" ,
1016- threadId : ThreadId . make ( "thread-1" ) ,
1017- path : htmlPath ,
1018- } ,
1019- workspaceRoot : root ,
1020- } ) ;
1021- const suffix = result . relativeUrl . slice ( `${ ASSET_ROUTE_PREFIX } /` . length ) ;
1022- const token = suffix . slice ( 0 , suffix . indexOf ( "/" ) ) ;
1023-
1024- for ( const [ name , filePath ] of [
1025- [ entryName , htmlPath ] ,
1026- [ "styles.css" , cssPath ] ,
1027- [ "scripts/app.js" , scriptPath ] ,
1028- [ "images/logo.png" , imagePath ] ,
1029- ] as const ) {
1030- expect ( yield * resolveAsset ( token , name ) ) . toEqual ( {
1031- kind : "file" ,
1032- path : yield * fileSystem . realPath ( filePath ) ,
1033- } ) ;
1034- }
1035- expect ( yield * resolveAsset ( token , "../outside.css" ) ) . toBeNull ( ) ;
1036- expect ( yield * resolveAsset ( token , "./styles.css" ) ) . toBeNull ( ) ;
1037- expect ( yield * resolveAsset ( token , "scripts/../styles.css" ) ) . toBeNull ( ) ;
1038- } ) . pipe ( Effect . provide ( layerTest ) ) ,
1039- ) ;
1040-
1041956 it . effect ( "previews workspace files with literal fragment characters in their paths" , ( ) =>
1042957 Effect . gen ( function * ( ) {
1043958 const fileSystem = yield * FileSystem . FileSystem ;
0 commit comments