Skip to content

Commit

Permalink
fix: extent name collision in transforms (#9312)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsh authored Apr 16, 2024
1 parent 406d486 commit 8b3b30b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ export function isFold(t: Transform): t is FoldTransform {
}

export function isExtent(t: Transform): t is ExtentTransform {
return 'extent' in t && !('density' in t);
return 'extent' in t && !('density' in t) && !('regression' in t);
}
export type Transform =
| AggregateTransform
Expand Down
15 changes: 15 additions & 0 deletions test/compile/data/extent.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
import {ExtentTransformNode} from '../../../src/compile/data/extent';
import {Transform} from '../../../src/transform';
import {PlaceholderDataFlowNode} from './util';
import {isExtent} from '../../../src/transform';

describe('compile/data/extent', () => {
describe('isExtent', () => {
it('should return true for a regular extent transform', () => {
expect(isExtent({extent: 'a', param: 'A'})).toBe(true);
});

it('should return false for a regression transform', () => {
expect(isExtent({regression: 'a', on: 'b', extent: [0, 10]})).toBe(false);
});

it('should return false for a density transform', () => {
expect(isExtent({density: 'a', extent: [0, 10]})).toBe(false);
});
});

describe('assemble', () => {
it('should return a proper vg transform', () => {
const transform: Transform = {
Expand Down

0 comments on commit 8b3b30b

Please sign in to comment.