@@ -807,41 +807,43 @@ describe("AssetAccess", () => {
807807 } ) . pipe ( Effect . provide ( layerTest ) ) ,
808808 ) ;
809809
810- it . effect ( "versions media by file changes rather than by re-signing" , ( ) =>
811- Effect . gen ( function * ( ) {
812- const fs = yield * FileSystem . FileSystem ;
813- const path = yield * Path . Path ;
814- const root = yield * fs . makeTempDirectoryScoped ( { prefix : "t3-media-revision-" } ) ;
815- const filePath = path . join ( root , "recording.mp4" ) ;
816- yield * fs . writeFileString ( filePath , "original" ) ;
817- yield * Effect . promise ( ( ) => NodeFSP . utimes ( filePath , 1_000 , 1_000 ) ) ;
818- const input = {
819- resource : {
820- _tag : "media-file" as const ,
821- threadId : ThreadId . make ( "thread-1" ) ,
822- path : filePath ,
823- } ,
824- } ;
825- const original = yield * issueAssetUrl ( input ) ;
826- expect ( original . fileRevision ) . toEqual ( expect . any ( String ) ) ;
827-
828- yield * TestClock . adjust ( "1 minute" ) ;
829- const renewed = yield * issueAssetUrl ( input ) ;
830- expect ( renewed . relativeUrl ) . not . toBe ( original . relativeUrl ) ;
831- expect ( renewed . fileRevision ) . toBe ( original . fileRevision ) ;
832-
833- yield * fs . writeFileString ( filePath , "modified" ) ;
834- yield * Effect . promise ( ( ) => NodeFSP . utimes ( filePath , 2_000 , 2_000 ) ) ;
835- const edited = yield * issueAssetUrl ( input ) ;
836- expect ( edited . fileRevision ) . not . toBe ( original . fileRevision ) ;
837-
838- const replacement = path . join ( root , "replacement.mp4" ) ;
839- yield * fs . writeFileString ( replacement , "modified" ) ;
840- yield * Effect . promise ( ( ) => NodeFSP . utimes ( replacement , 2_000 , 2_000 ) ) ;
841- yield * fs . rename ( replacement , filePath ) ;
842- const replaced = yield * issueAssetUrl ( input ) ;
843- expect ( replaced . fileRevision ) . not . toBe ( edited . fileRevision ) ;
844- } ) . pipe ( Effect . provide ( layerTest ) ) ,
810+ it . effect . each ( [ "media-file" , "workspace-file" , "draft-workspace-file" ] as const ) (
811+ "versions %s by file changes rather than by re-signing" ,
812+ ( kind ) =>
813+ Effect . gen ( function * ( ) {
814+ const fs = yield * FileSystem . FileSystem ;
815+ const path = yield * Path . Path ;
816+ const root = yield * fs . makeTempDirectoryScoped ( { prefix : "t3-media-revision-" } ) ;
817+ const filePath = path . join ( root , "report.html" ) ;
818+ yield * fs . writeFileString ( filePath , "original" ) ;
819+ yield * Effect . promise ( ( ) => NodeFSP . utimes ( filePath , 1_000 , 1_000 ) ) ;
820+ const input = {
821+ resource :
822+ kind === "draft-workspace-file"
823+ ? { _tag : kind , cwd : root , path : "report.html" }
824+ : { _tag : kind , threadId : ThreadId . make ( "thread-1" ) , path : filePath } ,
825+ workspaceRoot : root ,
826+ } ;
827+ const original = yield * issueAssetUrl ( input ) ;
828+ expect ( original . fileRevision ) . toEqual ( expect . any ( String ) ) ;
829+
830+ yield * TestClock . adjust ( "1 minute" ) ;
831+ const renewed = yield * issueAssetUrl ( input ) ;
832+ expect ( renewed . relativeUrl ) . not . toBe ( original . relativeUrl ) ;
833+ expect ( renewed . fileRevision ) . toBe ( original . fileRevision ) ;
834+
835+ yield * fs . writeFileString ( filePath , "modified" ) ;
836+ yield * Effect . promise ( ( ) => NodeFSP . utimes ( filePath , 2_000 , 2_000 ) ) ;
837+ const edited = yield * issueAssetUrl ( input ) ;
838+ expect ( edited . fileRevision ) . not . toBe ( original . fileRevision ) ;
839+
840+ const replacement = path . join ( root , "replacement.html" ) ;
841+ yield * fs . writeFileString ( replacement , "modified" ) ;
842+ yield * Effect . promise ( ( ) => NodeFSP . utimes ( replacement , 2_000 , 2_000 ) ) ;
843+ yield * fs . rename ( replacement , filePath ) ;
844+ const replaced = yield * issueAssetUrl ( input ) ;
845+ expect ( replaced . fileRevision ) . not . toBe ( edited . fileRevision ) ;
846+ } ) . pipe ( Effect . provide ( layerTest ) ) ,
845847 ) ;
846848
847849 it . effect ( "keeps in-place edits readable but requires a new URL after atomic replacement" , ( ) =>
0 commit comments