Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactored test to use toThrow instead of a getError function
  • Loading branch information
pbking committed Oct 18, 2023
commit eae4e9e41fc1c9991d836455be303ad069485f21
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
*/
import makeFamiliesFromFaces from '../make-families-from-faces';

const getError = ( call ) => {
try {
call();
throw new Error( 'No error thrown' );
} catch ( error ) {
return error;
}
};

describe( 'makeFamiliesFromFaces', () => {
it( 'handles empty fontFaces list', () => {
const result = makeFamiliesFromFaces( [] );
Expand Down Expand Up @@ -40,10 +31,10 @@ describe( 'makeFamiliesFromFaces', () => {
{ fontFamily: 'Duper Super', file: { name: 'piazzolla.ttf' } },
];

const error = getError( () => makeFamiliesFromFaces( fontFaces ) );
expect( error ).toHaveProperty(
'message',
'You may only batch upload fonts from the same font family.'
expect( () => makeFamiliesFromFaces( fontFaces ) ).toThrow(
new Error(
'You may only batch upload fonts from the same font family.'
)
);
} );

Expand Down