Skip to content

Commit

Permalink
Try to add default value and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joelostblom committed Nov 11, 2023
1 parent 996a4c4 commit bd567d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/compile/data/density.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class DensityTransformNode extends DataFlowNode {
this.transform = duplicate(transform); // duplicate to prevent side effects
const specifiedAs = this.transform.as ?? [undefined, undefined];
this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density'];
this.transform.resolve = 'independent';
}

public dependentFields() {
Expand Down
7 changes: 4 additions & 3 deletions test/compile/data/density.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('compile/data/fold', () => {
extent: [0, 10],
minsteps: 25,
maxsteps: 200,
resolve: 'shared',
resolve: 'independent',
as: ['x', 'y']
});
});
Expand Down Expand Up @@ -58,10 +58,11 @@ describe('compile/data/fold', () => {
});
});

it('should add resolve shared if we group', () => {
it('should only add resolve "shared" if we set it explicitly', () => {
const transform: Transform = {
density: 'v',
groupby: ['a']
groupby: ['a'],
resolve: 'shared',

Check warning on line 65 in test/compile/data/density.test.ts

View workflow job for this annotation

GitHub Actions / Runtime, Linting, and Coverage

Delete `,`
};
const density = new DensityTransformNode(null, transform);
expect(density.assemble()).toEqual({
Expand Down

0 comments on commit bd567d9

Please sign in to comment.