Skip to content

Commit

Permalink
fix(test): unhandled promise rejection (#4943)
Browse files Browse the repository at this point in the history
* fix(test): unhandle promise rejection

* feat(ci): reduce sleep time
  • Loading branch information
pearmini committed May 5, 2023
1 parent 0878230 commit 1ba1fcd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion __tests__/integration/chart-on-brush-filter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PLOT_CLASS_NAME } from '../../src';
import { dblclick, brush } from '../plots/interaction/penguins-point-brush';
import { createDOMGCanvas } from './utils/createDOMGCanvas';
import { createPromise, receiveExpectData } from './utils/event';
import { sleep } from './utils/sleep';
import './utils/useCustomFetch';

describe('chart.on', () => {
Expand All @@ -11,7 +12,7 @@ describe('chart.on', () => {

chart.off();

it('chart.on("element:filter", callback) should provide selection when filtering', async () => {
it('chart.on("brush:filter", callback) should provide selection when filtering', async () => {
await finished;
const { document } = canvas;
const plot = document.getElementsByClassName(PLOT_CLASS_NAME)[0];
Expand All @@ -29,6 +30,7 @@ describe('chart.on', () => {
);
brush(plot, 100, 100, 300, 300);
await filtered;
await sleep(20);

// Reset plot.
const [rested, resolve1] = createPromise();
Expand All @@ -44,6 +46,8 @@ describe('chart.on', () => {
);
setTimeout(() => dblclick(plot), 1000);
await rested;
// Wait for rerender over to close test.
await sleep(20);
});

afterAll(() => {
Expand Down
1 change: 1 addition & 0 deletions __tests__/plots/api/chart-on-brush-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function chartOnBrushFilter(context) {
x: 'culmen_length_mm',
y: 'culmen_depth_mm',
},
animate: false,
interaction: { brushFilter: true },
});

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"size": "limit-size",
"lint": "eslint ./src ./__tests__ && prettier ./src ./__tests__ --check ",
"fix": "eslint ./src ./__tests__ --fix && prettier ./src ./__tests__ --write ",
"test": "node --expose-gc --max-old-space-size=4096 node_modules/jest/bin/jest __tests__/ --coverage -i --logHeapUsage",
"test:unit": "node --expose-gc --max-old-space-size=4096 node_modules/jest/bin/jest __tests__/unit/ --coverage -i --logHeapUsage",
"test:integration": "node --expose-gc --max-old-space-size=4096 node_modules/jest/bin/jest __tests__/integration/ --coverage -i --logHeapUsage",
"test": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/ --coverage -i --logHeapUsage",
"test:unit": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/unit/ --coverage -i --logHeapUsage",
"test:integration": "node --expose-gc --max-old-space-size=4096 --unhandled-rejections=strict node_modules/jest/bin/jest __tests__/integration/ --coverage -i --logHeapUsage",
"test-live": "cross-env DEBUG_MODE=1 jest --watch",
"build:umd": "rimraf ./dist && rollup -c && npm run size",
"build:cjs": "rimraf ./lib && tsc --module commonjs --outDir lib",
Expand Down

0 comments on commit 1ba1fcd

Please sign in to comment.