Skip to content

Commit e851ddf

Browse files
committed
Simplify tests
1 parent c42a767 commit e851ddf

1 file changed

Lines changed: 21 additions & 60 deletions

File tree

tests/index.js

Lines changed: 21 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -395,73 +395,34 @@ test('set({ cameraTarget, cameraDistance, cameraRotation, cameraView })', (t) =>
395395
scatterplot.destroy();
396396
});
397397

398-
test('set({ colorBy })', (t) => {
398+
test('set({ colorBy, opacityBy, sizeBy, pointConnectionColorBy, pointConnectionOpacityBy, pointConnectionSizeBy })', (t) => {
399399
const scatterplot = createScatterplot({ canvas: createCanvas() });
400400

401-
Object.entries(valueVariants).forEach(([value, variants]) => {
402-
variants.forEach((variant) => {
403-
scatterplot.set({ colorBy: variant });
404-
405-
t.equal(
406-
scatterplot.get('colorBy'),
407-
value,
408-
`colorBy should be set to ${value}`
409-
);
401+
[
402+
'colorBy',
403+
'opacityBy',
404+
'sizeBy',
405+
'pointConnectionColorBy',
406+
'pointConnectionOpacityBy',
407+
'pointConnectionSizeBy',
408+
].forEach((property) => {
409+
Object.entries(valueVariants).forEach(([value, variants]) => {
410+
variants.forEach((variant) => {
411+
scatterplot.set({ [property]: variant });
412+
413+
t.equal(
414+
scatterplot.get(property),
415+
value,
416+
`${property} should be set to ${value}`
417+
);
418+
});
410419
});
411-
});
412420

413-
scatterplot.set({ colorBy: null });
414-
415-
t.equal(scatterplot.get('colorBy'), null, 'colorBy should be nullifyable');
416-
417-
scatterplot.destroy();
418-
});
421+
scatterplot.set({ [property]: null });
419422

420-
test('set({ opacityBy })', (t) => {
421-
const scatterplot = createScatterplot({ canvas: createCanvas() });
422-
423-
Object.entries(valueVariants).forEach(([value, variants]) => {
424-
variants.forEach((variant) => {
425-
scatterplot.set({ opacityBy: variant });
426-
427-
t.equal(
428-
scatterplot.get('opacityBy'),
429-
value,
430-
`opacityBy should be set to ${value}`
431-
);
432-
});
423+
t.equal(scatterplot.get(property), null, 'colorBy should be nullifyable');
433424
});
434425

435-
scatterplot.set({ opacityBy: null });
436-
437-
t.equal(
438-
scatterplot.get('opacityBy'),
439-
null,
440-
'opacityBy should be nullifyable'
441-
);
442-
443-
scatterplot.destroy();
444-
});
445-
446-
test('set({ sizeBy })', (t) => {
447-
const scatterplot = createScatterplot({ canvas: createCanvas() });
448-
449-
Object.entries(valueVariants).forEach(([value, variants]) => {
450-
variants.forEach((variant) => {
451-
scatterplot.set({ sizeBy: variant });
452-
453-
t.equal(
454-
scatterplot.get('sizeBy'),
455-
value,
456-
`sizeBy should be set to ${value}`
457-
);
458-
});
459-
});
460-
461-
scatterplot.set({ sizeBy: null });
462-
463-
t.equal(scatterplot.get('sizeBy'), null, 'sizeBy should be nullifyable');
464-
465426
scatterplot.destroy();
466427
});
467428

0 commit comments

Comments
 (0)