diff --git a/src/expression/types/color_array.test.ts b/src/expression/types/color_array.test.ts index 341c2ac6..75c3d3b9 100644 --- a/src/expression/types/color_array.test.ts +++ b/src/expression/types/color_array.test.ts @@ -43,6 +43,6 @@ describe('ColorArray', () => { expect(() => { ColorArray.interpolate(colorArray, targetColorArray, 0.5); - }).toThrow('colorArray: Arrays have mismatched length (2 vs. 1), cannot interpolate.'); + }).toThrowError('colorArray: Arrays have mismatched length (2 vs. 1), cannot interpolate.'); }); }); diff --git a/src/expression/types/variable_anchor_offset_collection.test.ts b/src/expression/types/variable_anchor_offset_collection.test.ts index a3c2d92f..ef71c317 100644 --- a/src/expression/types/variable_anchor_offset_collection.test.ts +++ b/src/expression/types/variable_anchor_offset_collection.test.ts @@ -39,12 +39,12 @@ describe('VariableAnchorOffsetCollection', () => { test('should throw with mismatched endpoints', () => { expect(() => i11nFn(parseFn(['top', [0, 0]]), parseFn(['bottom', [1, 1]]), 0.5) - ).toThrow( + ).toThrowError( 'Cannot interpolate values containing mismatched anchors. from[0]: top, to[0]: bottom' ); expect(() => i11nFn(parseFn(['top', [0, 0]]), parseFn(['top', [1, 1], 'bottom', [2, 2]]), 0.5) - ).toThrow( + ).toThrowError( 'Cannot interpolate values of different length. from: ["top",[0,0]], to: ["top",[1,1],"bottom",[2,2]]' ); }); diff --git a/src/feature_filter/feature_filter.test.ts b/src/feature_filter/feature_filter.test.ts index 54d89fee..07caeb25 100644 --- a/src/feature_filter/feature_filter.test.ts +++ b/src/feature_filter/feature_filter.test.ts @@ -88,15 +88,15 @@ describe('filter', () => { test('expression, type error', () => { expect(() => { featureFilter(['==', ['number', ['get', 'x']], ['string', ['get', 'y']]]); - }).toThrow(); + }).toThrowError(': Cannot compare types \'number\' and \'string\'.'); expect(() => { featureFilter(['number', ['get', 'x']]); - }).toThrow(); + }).toThrowError(": Expected boolean but found number instead."); expect(() => { featureFilter(['boolean', ['get', 'x']]); - }).not.toThrow(); + }).not.toThrowError(); }); test('expression, within', () => { diff --git a/src/function/index.test.ts b/src/function/index.test.ts index ca48ecb8..a3581344 100644 --- a/src/function/index.test.ts +++ b/src/function/index.test.ts @@ -284,7 +284,7 @@ describe('exponential function', () => { type: 'color' } ); - }).toThrow('Unknown color space: "invalid"'); + }).toThrowError('Unknown color space: "invalid"'); }); test('exponential interpolation of colorArray', () => { @@ -367,7 +367,7 @@ describe('exponential function', () => { type: 'colorArray' } ); - }).toThrow('Unknown color space: "invalid"'); + }).toThrowError('Unknown color space: "invalid"'); }); test('exponential interpolation of numberArray', () => { @@ -1536,7 +1536,7 @@ test('unknown function', () => { type: 'string' } ) - ).toThrow(/Unknown function type "nonesuch"/); + ).toThrowError(/Unknown function type "nonesuch"/); }); describe('kind', () => { diff --git a/src/migrate.test.ts b/src/migrate.test.ts index 21965eab..ed3a0d98 100644 --- a/src/migrate.test.ts +++ b/src/migrate.test.ts @@ -9,13 +9,13 @@ describe('migrate', () => { test('does not migrate from version 5', () => { expect(() => { migrate({version: 5, layers: []} as any); - }).toThrow(new Error('Cannot migrate from 5')); + }).toThrowError('Cannot migrate from 5'); }); test('does not migrate from version 6', () => { expect(() => { migrate({version: 6, layers: []} as any); - }).toThrow(new Error('Cannot migrate from 6')); + }).toThrowError('Cannot migrate from 6'); }); test('migrates to latest version from version 7', () => { @@ -181,7 +181,7 @@ describe('migrate', () => { ] }; - expect(() => migrate(style)).not.toThrow(); + expect(() => migrate(style)).not.toThrowError(); expect(style.layers[0].paint).toEqual({ 'icon-color': 'hsl(100,30%,20%)', 'icon-opacity-transition': {duration: 0}