File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -41,12 +41,12 @@ describe('Sound', () => {
4141 expect ( zzfxMock ) . not . toHaveBeenCalled ( ) ;
4242 } ) ;
4343
44- it ( 'should propagate errors from zzfx' , ( ) => {
44+ it ( 'should propagate not errors from zzfx' , ( ) => {
4545 zzfxMock . mockImplementation ( ( ) => {
4646 throw new Error ( 'Test error' ) ;
4747 } ) ;
4848
49- expect ( ( ) => sound . play ( SOUNDS . SELECT ) ) . toThrow ( 'Test error' ) ;
49+ expect ( ( ) => sound . play ( SOUNDS . SELECT ) ) . not . toThrow ( 'Test error' ) ;
5050 } ) ;
5151 } ) ;
5252} ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ export class Sound {
2020 if ( ! this . enabled ) {
2121 return ;
2222 }
23- zzfx ( ...sound ) ;
23+ try {
24+ zzfx ( ...sound ) ;
25+ } catch {
26+ // nope, we ignore platforms which do not support web audio
27+ }
2428 }
2529}
You can’t perform that action at this time.
0 commit comments