Compare commits

...

2 Commits

Author SHA1 Message Date
rusackas
822f2fc010 test(deckgl): use reported Feature-shaped fixture for polygon-column regression test
Per review feedback on #42591: the regression fixture for #33669 used a
bare coordinate array, but the CSV attached to the issue is a GeoJSON
Feature with nested geometry.coordinates, a different parsing path in
getPolygonCoordinateParts. Switch the fixture to that shape and cover
both reported column-name spellings ("polygon" and "Polygon").

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-01 11:01:28 -07:00
Claude Code
f674171aa2 test(deckgl): Polygon chart with a column literally named "polygon" (#33669)
Regression for #33669: a boundary column named "polygon" allegedly
broke deck.gl Polygon chart rendering, presumably a naming collision
with the internal `polygon` key transformProps.ts builds on each
feature. Adds a test pinning the actual reported scenario against the
current preset-chart-deckgl Polygon transform (the prior investigation
in the issue thread tested the wrong chart type, deck.gl GeoJSON
instead of Polygon).

The test passes: `line_column` is excluded before a record's other
properties are spread onto the feature, and the parsed `polygon` key
is assigned last in the returned object literal, so it always wins
over anything copied from the raw record, even when they share a name.

Closes #33669

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-29 16:42:11 -07:00

View File

@@ -529,4 +529,66 @@ describe('Polygon transformProps', () => {
expect(features[0]?.extraProps?.['SUM(population)']).toBe(50000);
expect(features[0]?.metrics?.['SUM(population)']).toBe(50000);
});
// Regression test for #33669: a boundary column literally named "polygon"
// (the same key this transform uses internally for the parsed geometry)
// reportedly broke rendering, because the raw column value could
// theoretically collide with the `polygon` key this function builds on
// each feature. `line_column` is excluded before spreading a record's
// other properties onto the feature, and the parsed `polygon` key is
// assigned last in the returned object literal, so it should always win
// over anything copied from the raw record, even when they share a name.
//
// The fixture mirrors the GeoJSON `Feature` shape from the CSV attached to
// the issue (a `Feature` with nested `geometry.coordinates`), not a bare
// coordinate array, since those two shapes take different parsing paths
// in `getPolygonCoordinateParts`. Both reported column-name spellings,
// "polygon" and "Polygon", are covered.
test.each(['polygon', 'Polygon'])(
'should correctly parse polygon geometry when the boundary column is itself named "%s"',
columnName => {
const collidingColumnNameProps = {
...mockChartProps,
rawFormData: {
...mockChartProps.rawFormData,
line_column: columnName,
},
queriesData: [
{
data: [
{
[columnName]: JSON.stringify({
type: 'Feature',
geometry: {
type: 'Polygon',
coordinates: [
[
[-122.4, 37.8],
[-122.3, 37.8],
[-122.3, 37.9],
[-122.4, 37.9],
],
],
},
properties: { NOM_COM: 'TEST' },
}),
population: 50000,
},
],
},
],
};
const result = transformProps(collidingColumnNameProps as ChartProps);
const features = result.payload.data.features as PolygonFeature[];
expect(features).toHaveLength(1);
expect(features[0]?.polygon).toEqual([
[-122.4, 37.8],
[-122.3, 37.8],
[-122.3, 37.9],
[-122.4, 37.9],
]);
},
);
});