Skip to content

Commit

Permalink
Use destructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed May 25, 2017
1 parent ecede38 commit 010f425
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
20 changes: 10 additions & 10 deletions test/unit/style/style.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,8 @@ test('Style#addLayer', (t) => {
};

style.on('style.load', () => {
style.on('error', (e) => {
t.match(e.error.message, /does not exist on source/);
style.on('error', ({ error }) => {
t.match(error.message, /does not exist on source/);
t.end();
});
style.addLayer(layer);
Expand Down Expand Up @@ -882,8 +882,8 @@ test('Style#removeLayer', (t) => {
const style = new Style(createStyleJSON());

style.on('style.load', () => {
style.on('error', (e) => {
t.match(e.error.message, /does not exist in the map\'s style and cannot be removed/);
style.on('error', ({ error }) => {
t.match(error.message, /does not exist in the map\'s style and cannot be removed/);
t.end();
});
style.removeLayer('background');
Expand Down Expand Up @@ -961,8 +961,8 @@ test('Style#moveLayer', (t) => {
const style = new Style(createStyleJSON());

style.on('style.load', () => {
style.on('error', (e) => {
t.match(e.error.message, /does not exist in the map\'s style and cannot be moved/);
style.on('error', ({ error }) => {
t.match(error.message, /does not exist in the map\'s style and cannot be moved/);
t.end();
});
style.moveLayer('background');
Expand Down Expand Up @@ -1080,8 +1080,8 @@ test('Style#setFilter', (t) => {
const style = createStyle();

style.on('style.load', () => {
style.on('error', (e) => {
t.match(e.error.message, /does not exist in the map\'s style and cannot be filtered/);
style.on('error', ({ error }) => {
t.match(error.message, /does not exist in the map\'s style and cannot be filtered/);
t.end();
});
style.setFilter('non-existant', ['==', 'id', 1]);
Expand Down Expand Up @@ -1135,8 +1135,8 @@ test('Style#setLayerZoomRange', (t) => {
t.test('fires an error if layer not found', (t) => {
const style = createStyle();
style.on('style.load', () => {
style.on('error', (e) => {
t.match(e.error.message, /does not exist in the map\'s style and cannot have zoom extent/);
style.on('error', ({ error }) => {
t.match(error.message, /does not exist in the map\'s style and cannot have zoom extent/);
t.end();
});
style.setLayerZoomRange('non-existant', 5, 12);
Expand Down
12 changes: 6 additions & 6 deletions test/unit/ui/camera.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1156,9 +1156,9 @@ test('camera', (t) => {

camera.on('moveend', () => {
t.equalWithPrecision(camera.getZoom(), 10, 1e-10);
const center = camera.getCenter();
t.equalWithPrecision(center.lng, 12, 1e-10);
t.equalWithPrecision(center.lat, 34, 1e-10);
const { lng, lat } = camera.getCenter();
t.equalWithPrecision(lng, 12, 1e-10);
t.equalWithPrecision(lat, 34, 1e-10);

t.end();
});
Expand All @@ -1176,9 +1176,9 @@ test('camera', (t) => {

camera.on('moveend', () => {
t.equalWithPrecision(camera.getZoom(), 2, 1e-10);
const center = camera.getCenter();
t.equalWithPrecision(center.lng, 12, 1e-10);
t.equalWithPrecision(center.lat, 34, 1e-10);
const { lng, lat } = camera.getCenter();
t.equalWithPrecision(lng, 12, 1e-10);
t.equalWithPrecision(lat, 34, 1e-10);

t.end();
});
Expand Down
12 changes: 6 additions & 6 deletions test/unit/ui/map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ test('Map', (t) => {
const map = createMap({style: style});

map.on('load', () => {
map.on('error', (e) => {
t.match(e.error.message, /There is no source with ID/);
map.on('error', ({ error }) => {
t.match(error.message, /There is no source with ID/);
t.end();
});
map.isSourceLoaded('geojson');
Expand Down Expand Up @@ -964,8 +964,8 @@ test('Map', (t) => {
});

map.on('style.load', () => {
map.style.on('error', (e) => {
t.match(e.error.message, /does not exist in the map\'s style and cannot be styled/);
map.style.on('error', ({ error }) => {
t.match(error.message, /does not exist in the map\'s style and cannot be styled/);
t.end();
});
map.setLayoutProperty('non-existant', 'text-transform', 'lowercase');
Expand Down Expand Up @@ -1170,8 +1170,8 @@ test('Map', (t) => {
});

map.on('style.load', () => {
map.style.on('error', (e) => {
t.match(e.error.message, /does not exist in the map\'s style and cannot be styled/);
map.style.on('error', ({ error }) => {
t.match(error.message, /does not exist in the map\'s style and cannot be styled/);
t.end();
});
map.setPaintProperty('non-existant', 'background-color', 'red');
Expand Down

0 comments on commit 010f425

Please sign in to comment.