@@ -47,19 +47,30 @@ function json(body, status = 200) {
4747 } ) ;
4848}
4949
50+ function brewFormulaText ( version ) {
51+ const tag = encodeURIComponent ( `@pymodel/pythinker-code@${ version } ` ) ;
52+ return [
53+ 'class PythinkerCode < Formula' ,
54+ ` version "${ version } "` ,
55+ ` url "https://github.com/PyModel/pythinker-code/releases/download/${ tag } /pythinker-code-darwin-arm64.tar.gz"` ,
56+ '' ,
57+ ] . join ( '\n' ) ;
58+ }
59+
5060function fixtureFetch ( {
5161 cliAssets = expectedCliAssets ,
5262 nightlyAssets = desktopAssets ( desktopNightlyVersion , 'nightly' ) ,
5363 brewVersion = '1.3.0' ,
64+ brewFormula,
5465} = { } ) {
5566 return async ( input ) => {
5667 const url = new URL ( String ( input ) ) ;
5768 if ( url . hostname === 'registry.npmjs.org' ) return json ( { latest : '1.3.0' } ) ;
5869 if ( url . hostname === 'raw.githubusercontent.com' ) {
59- return new Response (
60- `url "https://registry.npmjs.org/@pymodel/pythinker-code/-/pythinker-code- ${ brewVersion } .tgz"\n` ,
61- { status : 200 , headers : { 'content-type' : 'text/plain' } } ,
62- ) ;
70+ return new Response ( brewFormula ?? brewFormulaText ( brewVersion ) , {
71+ status : 200 ,
72+ headers : { 'content-type' : 'text/plain' } ,
73+ } ) ;
6374 }
6475 if ( url . hostname === 'code.pythinker.com' ) {
6576 return json ( {
@@ -165,6 +176,21 @@ void test('fails when the Homebrew formula lags the published CLI version', asyn
165176 assert . equal ( brew ?. observed , '1.2.0' ) ;
166177} ) ;
167178
179+ void test ( 'fails when the Homebrew formula has no version stanza' , async ( t ) => {
180+ const rootDir = await fixtureRoot ( t ) ;
181+ const result = await collectReleaseStatus ( {
182+ rootDir,
183+ desktopCommitCount,
184+ fetchImpl : fixtureFetch ( { brewFormula : 'class PythinkerCode < Formula\n' } ) ,
185+ } ) ;
186+
187+ assert . equal ( result . ok , false ) ;
188+ const brew = result . rows . find ( ( row ) => row . lane === 'Homebrew' ) ;
189+ assert . equal ( brew ?. ok , false ) ;
190+ assert . equal ( brew ?. observed , 'unavailable' ) ;
191+ assert . match ( brew ?. details ?? '' , / n o p y t h i n k e r - c o d e t a r b a l l v e r s i o n / u) ;
192+ } ) ;
193+
168194void test ( 'fails when the current desktop Nightly release is incomplete' , async ( t ) => {
169195 const rootDir = await fixtureRoot ( t ) ;
170196 const result = await collectReleaseStatus ( {
0 commit comments