@@ -1657,6 +1657,15 @@ test('CLI analysis keeps watch paths received while files were being read', () =
16571657 assert . deepEqual ( J ( context . noteCliWatchPathIfRead ( [ 'src/app.js' ] , 'src/later.js' , { 'src/app.js' : true } ) ) , [ 'src/app.js' ] ) ;
16581658 assert . deepEqual ( J ( context . noteCliWatchPathIfRead ( [ ] , 'src/app.js' , { } ) ) , [ ] ) ;
16591659 assert . deepEqual ( J ( context . noteCliWatchPathIfRead ( [ ] , 'src/app.js' , null ) ) , [ ] ) ;
1660+ assert . deepEqual ( J ( context . forgetCliWatchPath ( [ 'src/app.js' , 'src/math.js' ] , 'src/app.js' ) ) , [ 'src/math.js' ] ) ;
1661+ assert . deepEqual ( J ( context . forgetCliWatchPath ( [ 'src/app.js' ] , 'src/math.js' ) ) , [ 'src/app.js' ] ) ;
1662+ assert . deepEqual ( J ( context . forgetCliWatchPath ( [ 'src/app.js' ] , '' ) ) , [ 'src/app.js' ] ) ;
1663+ const analyzed = [ { path : 'src/app.js' , content : 'export const n = 1;\n' } , { path : 'src/math.js' , content : 'export const n = 2;\n' } ] ;
1664+ assert . equal ( context . analyzedFileForCliWatchPath ( analyzed , '/src/app.js' ) . content , 'export const n = 1;\n' ) ;
1665+ assert . equal ( context . cliWatchLiveMatchesBaseline ( analyzed [ 0 ] , 'export const n = 1;\n' ) , true ) ;
1666+ assert . equal ( context . cliWatchLiveMatchesBaseline ( analyzed [ 0 ] , 'export const n = 2;\n' ) , false ) ;
1667+ assert . equal ( context . cliWatchLiveMatchesBaseline ( analyzed [ 0 ] , '' ) , false ) ;
1668+ assert . equal ( context . cliWatchLiveMatchesBaseline ( { path : 'src/app.js' , content : 'export const n = 1;\n' , analysisSkipped : 'fetch-failed' } , 'export const n = 1;\n' ) , false ) ;
16601669 assert . deepEqual ( J ( context . cliWatchLiveFromResponse ( 200 , 'ok\n' , true ) ) , { kind : 'ok' , content : 'ok\n' } ) ;
16611670 assert . deepEqual ( J ( context . cliWatchLiveFromResponse ( 404 , 'nope' , false ) ) , { kind : 'missing' , content : '' } ) ;
16621671 assert . deepEqual ( J ( context . cliWatchLiveFromResponse ( 500 , 'err' , false ) ) , { kind : 'error' } ) ;
@@ -1855,6 +1864,8 @@ test('index.html ships a working Code view, not a stub', () => {
18551864 assert . match ( htmlSource , / c l i W a t c h R e a d R e f \. c u r r e n t \[ n o r m a l i z e C l i W a t c h P a t h \( f \. p a t h \) \] = t r u e / ) ;
18561865 assert . match ( htmlSource , / r e a d C l i W a t c h L i v e S o u r c e \( p a t h \) / ) ;
18571866 assert . match ( htmlSource , / i f \( ! s h o u l d A p p l y C l i W a t c h L i v e \( r e s u l t \) \) r e t u r n / ) ;
1867+ assert . match ( htmlSource , / i f \( c l i W a t c h L i v e M a t c h e s B a s e l i n e \( f i l e , l i v e \) \) / ) ;
1868+ assert . match ( htmlSource , / s e t C l i D i r t y \( f u n c t i o n \( p r e v \) \{ r e t u r n f o r g e t C l i W a t c h P a t h \( p r e v , p a t h \) ; \} / ) ;
18581869 assert . match ( htmlSource , / s e t C l i D i r t y \( k e e p \) / ) ;
18591870 assert . doesNotMatch ( htmlSource , / s e t C a c h e d F r o m I d \( n u l l \) ; \s * s e t C l i D i r t y \( \[ \] \) ; \s * c l e a r C l i L i v e D i f f s \( \) ; / ) ;
18601871 assert . match ( htmlSource , / c o d e C a r d S i z e F o r D i f f \( f i l e , p r e f s , r o w s \) / ) ;
0 commit comments