From 9e248d160dea2aa832a6003a824f536ca5535fbd Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 16:53:10 -0700 Subject: [PATCH] fix ut (#1040) (#1041) (cherry picked from commit 42707105a59d7757e4b7c6ab3fd55ad1e7c63a80) Signed-off-by: Hailong Cui Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- .../MonitorTimeField/MonitorTimeField.test.js | 8 +- .../MonitorTimeField.test.js.snap | 503 ++++++++++++++++++ test/jest.config.js | 3 +- 3 files changed, 509 insertions(+), 5 deletions(-) diff --git a/public/pages/CreateMonitor/components/MonitorTimeField/MonitorTimeField.test.js b/public/pages/CreateMonitor/components/MonitorTimeField/MonitorTimeField.test.js index e8b8d9be3..6fd5728f1 100644 --- a/public/pages/CreateMonitor/components/MonitorTimeField/MonitorTimeField.test.js +++ b/public/pages/CreateMonitor/components/MonitorTimeField/MonitorTimeField.test.js @@ -27,7 +27,7 @@ describe('MonitorTimeField', () => { ); // Default blank option - expect(wrapper.find('EuiComboBox').props().options.length).toBe(0); + expect(wrapper.find('EuiCompressedComboBox').props().options.length).toBe(0); }); test('displays options', () => { @@ -37,7 +37,7 @@ describe('MonitorTimeField', () => { ); // 3 options - expect(wrapper.find('EuiComboBox').props().options.length).toBe(3); + expect(wrapper.find('EuiCompressedComboBox').props().options.length).toBe(3); }); test('displays options includes date_nanos', () => { @@ -51,8 +51,8 @@ describe('MonitorTimeField', () => { expect(wrapper).toMatchSnapshot(); // 4 options - expect(wrapper.find('EuiComboBox').props().options.length).toBe(4); - expect(wrapper.find('EuiComboBox').props().options).toEqual( + expect(wrapper.find('EuiCompressedComboBox').props().options.length).toBe(4); + expect(wrapper.find('EuiCompressedComboBox').props().options).toEqual( expect.arrayContaining([{ label: 'date_nanos1' }]) ); }); diff --git a/public/pages/CreateMonitor/components/MonitorTimeField/__snapshots__/MonitorTimeField.test.js.snap b/public/pages/CreateMonitor/components/MonitorTimeField/__snapshots__/MonitorTimeField.test.js.snap index c386f7017..32056c9fe 100644 --- a/public/pages/CreateMonitor/components/MonitorTimeField/__snapshots__/MonitorTimeField.test.js.snap +++ b/public/pages/CreateMonitor/components/MonitorTimeField/__snapshots__/MonitorTimeField.test.js.snap @@ -1,5 +1,508 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`MonitorTimeField displays options includes date_nanos 1`] = ` + + + + + + + +
+
+ + + +
+
+ + +
+ + +
+
+
+

+ Select a time field +

+ +
+ +
+
+ +
+ +
+ + + +
+
+
+
+ + +
+ + + +
+ Choose the time field you want to use for your x-axis +
+
+
+
+ + + + + + + +`; + exports[`MonitorTimeField renders 1`] = `
/test/mocks/styleMock.js', '^ui/(.*)': '/../../src/legacy/ui/public/$1/', + '^!!raw-loader!.*': 'jest-raw-loader', }, snapshotSerializers: ['../../node_modules/enzyme-to-json/serializer'], coverageReporters: ['lcov', 'text', 'cobertura'], @@ -50,6 +51,6 @@ module.exports = { transformIgnorePatterns: [ // ignore all node_modules except d3-color which requires babel transforms to handle export statement // since ESM modules are not natively supported in Jest yet (https://github.com/facebook/jest/issues/4842) - '[/\\\\]node_modules(?![\\/\\\\](d3-color))[/\\\\].+\\.js$', + '[/\\\\]node_modules(?![\\/\\\\](monaco-editor|weak-lru-cache|ordered-binary|d3-color|axios))[/\\\\].+\\.js$', ], };