File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -630,7 +630,7 @@ describe('ApiMailAdapter', () => {
630630 expect ( htmlSpyData . toString ( 'utf8' ) ) . toEqual ( htmlFileData . toString ( 'utf8' ) ) ;
631631 } ) ;
632632
633- it ( 'falls back to default file if there is no language or locale match' , async function ( ) {
633+ it ( 'falls back to default file if there is no language or locale match' , async ( ) => {
634634 // Pretend that there are no files in folders `de-AT` and `de`
635635 spyOn ( adapter , '_fileExists' ) . and . callFake ( async ( path ) => {
636636 return ! / \/ t e m p l a t e s \/ d e ( - A T ) ? \/ / . test ( path ) ;
@@ -650,6 +650,16 @@ describe('ApiMailAdapter', () => {
650650 expect ( htmlSpyData . toString ( 'utf8' ) ) . toEqual ( htmlFileData . toString ( 'utf8' ) ) ;
651651 } ) ;
652652
653+ it ( 'falls back to default file if file reading throws' , async ( ) => {
654+ const getLocalizedFilePathSpy = spyOn ( adapter , '_getLocalizedFilePath' ) . and . callThrough ( ) ;
655+ spyOn ( fs , 'access' ) . and . callFake ( async ( ) => {
656+ throw 'Test file access error' ;
657+ } ) ;
658+ await adapter . _createApiData ( options ) ;
659+ const file = await getLocalizedFilePathSpy . calls . all ( ) [ 0 ] . returnValue ;
660+ expect ( file ) . toMatch ( options . template . subjectPath ) ;
661+ } ) ;
662+
653663 it ( 'makes user locale available in API callback' , async ( ) => {
654664 const locale = await options . template . localeCallback ( ) ;
655665 const email = {
You can’t perform that action at this time.
0 commit comments