test( 'isErrorInstanceOf() returns true when "errorTypeThrown" equals the error thrown', function( assert ) { assert.expect( 1 ); try { throwChartError( 'This is a test' ); } catch ( error ) { assert.strictEqual( isErrorInstanceOf( 'chart' ), true, 'isErrorInstanceOf() returns correct result when "errorTypeThrown" is set' ); } });
test( 'errorWasThrown() returns true when "errorTypeThrown" is set', function( assert ) { assert.expect( 1 ); try { throwChartError( 'This is a test' ); } catch ( error ) { assert.strictEqual( errorWasThrown(), true, 'errorWasThrown() returns correct result when "errorTypeThrown" is set' ); } });
test( 'throwChartError() sets attributes on chart error', function( assert ) { assert.expect( 2 ); try { throwChartError( 'This is a test' ); } catch ( error ) { assert.strictEqual( error.name, 'sl-chart', 'throwChartError() returns an instance with name set correctly' ); assert.strictEqual( error.message, 'This is a test', 'throwChartError() returns an instance with message set correctly' ); } });