@@ -34,6 +34,11 @@ const ignoredControllerRevisionEntries: ReadonlyArray<string> = [
3434 "node_modules" ,
3535 "out"
3636]
37+ const ignoredControllerRevisionEntrySubsetArbitrary = fc . uniqueArray (
38+ fc . constantFrom ( ...ignoredControllerRevisionEntries ) ,
39+ { maxLength : ignoredControllerRevisionEntries . length , minLength : 1 }
40+ )
41+ const revisionFileContentsArbitrary = fc . string ( { maxLength : 256 } )
3742
3843type MemoryFileEntry =
3944 | { readonly _tag : "Directory" }
@@ -101,6 +106,12 @@ const createMemoryFileSystemLayer = () => {
101106 } )
102107}
103108
109+ const assertControllerRevisionProperty = < Ts > ( property : fc . IAsyncProperty < Ts > ) =>
110+ Effect . tryPromise ( {
111+ catch : ( cause ) => cause ,
112+ try : ( ) => fc . assert ( property , { numRuns : 25 } )
113+ } )
114+
104115describe ( "controller reachability" , ( ) => {
105116 it . effect ( "builds direct API candidates without Docker inspection" , ( ) =>
106117 Effect . sync ( ( ) => {
@@ -274,29 +285,39 @@ describe("controller reachability", () => {
274285 } ) )
275286
276287 it . effect ( "ignores generated paths when computing controller revisions" , ( ) =>
277- Effect . gen ( function * ( _ ) {
278- const fs = yield * _ ( FileSystem . FileSystem )
279- const path = yield * _ ( Path . Path )
280- const rootDir = "/memory"
281- const sourceDir = path . join ( rootDir , "src" )
282- yield * _ ( fs . makeDirectory ( sourceDir , { recursive : true } ) )
283- yield * _ ( fs . writeFileString ( path . join ( sourceDir , "tracked.ts" ) , "export const value = 1\n" ) )
288+ assertControllerRevisionProperty (
289+ fc . asyncProperty (
290+ revisionFileContentsArbitrary ,
291+ ignoredControllerRevisionEntrySubsetArbitrary ,
292+ revisionFileContentsArbitrary ,
293+ ( trackedContents , ignoredEntries , generatedContents ) =>
294+ Effect . runPromise (
295+ Effect . gen ( function * ( _ ) {
296+ const fs = yield * _ ( FileSystem . FileSystem )
297+ const path = yield * _ ( Path . Path )
298+ const rootDir = "/memory"
299+ const sourceDir = path . join ( rootDir , "src" )
300+ yield * _ ( fs . makeDirectory ( sourceDir , { recursive : true } ) )
301+ yield * _ ( fs . writeFileString ( path . join ( sourceDir , "tracked.ts" ) , trackedContents ) )
284302
285- const before = yield * _ ( computeRevisionFromInputs ( rootDir , [ "src" ] ) )
303+ const before = yield * _ ( computeRevisionFromInputs ( rootDir , [ "src" ] ) )
286304
287- for ( const entry of ignoredControllerRevisionEntries ) {
288- if ( entry === ".git" ) {
289- yield * _ ( fs . writeFileString ( path . join ( sourceDir , entry ) , "gitdir: ignored\n" ) )
290- continue
291- }
292- yield * _ ( fs . makeDirectory ( path . join ( sourceDir , entry ) , { recursive : true } ) )
293- yield * _ ( fs . writeFileString ( path . join ( sourceDir , entry , "generated.txt" ) , "ignored\n" ) )
294- }
305+ for ( const entry of ignoredEntries ) {
306+ if ( entry === ".git" ) {
307+ yield * _ ( fs . writeFileString ( path . join ( sourceDir , entry ) , generatedContents ) )
308+ continue
309+ }
310+ yield * _ ( fs . makeDirectory ( path . join ( sourceDir , entry ) , { recursive : true } ) )
311+ yield * _ ( fs . writeFileString ( path . join ( sourceDir , entry , "generated.txt" ) , generatedContents ) )
312+ }
295313
296- const after = yield * _ ( computeRevisionFromInputs ( rootDir , [ "src" ] ) )
297- expect ( after ) . toBe ( before )
298- } ) . pipe (
299- Effect . provide ( createMemoryFileSystemLayer ( ) ) ,
300- Effect . provide ( Path . layer )
314+ const after = yield * _ ( computeRevisionFromInputs ( rootDir , [ "src" ] ) )
315+ expect ( after ) . toBe ( before )
316+ } ) . pipe (
317+ Effect . provide ( createMemoryFileSystemLayer ( ) ) ,
318+ Effect . provide ( Path . layer )
319+ )
320+ )
321+ )
301322 ) )
302323} )
0 commit comments