@@ -210,8 +210,9 @@ describe("Ember Ezsp Layer", () => {
210210
211211 it ( "Restarts ASH layer when received ERROR from port" , async ( ) => {
212212 let restart : ( ) => Promise < EzspStatus > ;
213+ const emitSpy = vi . spyOn ( ezsp , "emit" ) ;
213214 // @ts -expect-error private
214- const onAshFatalErrorSpy = vi . spyOn ( ezsp , "onAshFatalError" ) . mockImplementationOnce ( ( _status : EzspStatus ) : void => {
215+ const onAshFatalErrorSpy = vi . spyOn ( ezsp , "onAshFatalError" ) . mockImplementationOnce ( ( status : EzspStatus ) : void => {
215216 // mimic EmberAdapter onNcpNeedsResetAndInit
216217 restart = async ( ) => {
217218 vi . useRealTimers ( ) ;
@@ -225,6 +226,8 @@ describe("Ember Ezsp Layer", () => {
225226 await emitFromSerial ( ezsp , Buffer . from ( RECD_RSTACK_BYTES ) ) ;
226227 return await Promise . resolve ( startResult ) ;
227228 } ;
229+ // @ts -expect-error private
230+ ezsp . onAshFatalError ( status ) ;
228231 } ) ;
229232 const startResult = ezsp . start ( ) ;
230233
@@ -257,7 +260,8 @@ describe("Ember Ezsp Layer", () => {
257260 await expect ( restart ( ) ) . resolves . toStrictEqual ( EzspStatus . SUCCESS ) ;
258261 //@ts -expect-error private
259262 expect ( ezsp . ash . serialPort . port . recording ) . toStrictEqual ( POST_RSTACK_SERIAL_BYTES ) ;
260- expect ( onAshFatalErrorSpy ) . toHaveBeenCalledWith ( EzspStatus . HOST_FATAL_ERROR ) ;
263+ expect ( onAshFatalErrorSpy ) . toHaveBeenCalledWith ( EzspStatus . ASH_NCP_FATAL_ERROR ) ;
264+ expect ( emitSpy ) . toHaveBeenCalledWith ( "ncpNeedsResetAndInit" , EzspStatus . ASH_NCP_FATAL_ERROR ) ;
261265 expect ( ezsp . checkConnection ( ) ) . toBeTruthy ( ) ;
262266 } ) ;
263267
0 commit comments