Skip to content

Commit a449d2c

Browse files
committed
Fixed failing unit tests
1 parent 3ae3794 commit a449d2c

5 files changed

Lines changed: 15 additions & 2 deletions

File tree

jest.setup.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { performance } from 'perf_hooks';
44
import 'jest-canvas-mock';
55
import './__mocks__/dh-core';
66
import Log from '@deephaven/log';
7+
import { TestUtils } from '@deephaven/utils';
78

89
let logLevel = parseInt(process.env.DH_LOG_LEVEL ?? '', 10);
910
if (!Number.isFinite(logLevel)) {
@@ -34,6 +35,13 @@ Object.defineProperty(window, 'matchMedia', {
3435

3536
Object.defineProperty(window, 'performance', {
3637
value: performance,
38+
writable: true,
39+
});
40+
41+
Object.defineProperty(window, 'ResizeObserver', {
42+
value: function () {
43+
return TestUtils.createMockProxy<ResizeObserver>();
44+
},
3745
});
3846

3947
Object.defineProperty(window, 'TextDecoder', {

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"@deephaven/redux": "file:../redux",
7070
"@deephaven/stylelint-config": "file:../stylelint-config",
7171
"@deephaven/tsconfig": "file:../tsconfig",
72+
"@deephaven/utils": "file:../utils",
7273
"@fortawesome/fontawesome-common-types": "^6.1.1",
7374
"@playwright/test": "^1.30.0",
7475
"@testing-library/jest-dom": "^5.16.4",

packages/console/src/monaco/MonacoUtils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ describe('disableKeyBindings', () => {
173173

174174
keybindingsList.forEach(keybindings => {
175175
expect(editor.addAction).toHaveBeenCalledWith({
176-
id: expect.stringMatching(/^disable-keybindings-[^-]+/),
176+
id: expect.stringMatching(/^disable-keybindings-.+/),
177177
label: '',
178178
keybindings,
179179
run: expect.any(Function),

packages/iris-grid/src/sidebar/CustomColumnBuilder.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ test('Ignores deleted formulas on save', async () => {
100100
// There is an issue with populating the custom columns and then editing the existing column
101101
// RTL/monaco aren't playing nicely and it won't edit the existing text
102102
// This test instead creates the new text, saves, then removes it to test the same behavior
103-
jest.useFakeTimers();
103+
jest.useFakeTimers({
104+
// Monaco makes a call to performance.mark(), so we need to leave it in-tact
105+
doNotFake: ['performance'],
106+
});
104107
const user = userEvent.setup({ delay: null });
105108
const model = irisGridTestUtils.makeModel();
106109
const mockSave = jest.fn(() =>

0 commit comments

Comments
 (0)