From e22348b8547a66a6a79d3ade5da95702df4cf19c Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Tue, 18 Aug 2020 17:02:20 -0700 Subject: [PATCH 01/11] allow tests in jest confg --- superset-frontend/jest.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset-frontend/jest.config.js b/superset-frontend/jest.config.js index 6a5931e840d3..2d02d8386cf0 100644 --- a/superset-frontend/jest.config.js +++ b/superset-frontend/jest.config.js @@ -17,7 +17,7 @@ * under the License. */ module.exports = { - testRegex: '\\/spec\\/.*(_spec|\\.test)\\.(j|t)sx?$', + testRegex: '(\\/spec|\\/src)\\/.*(_spec|\\.test)\\.(j|t)sx?$', moduleNameMapper: { '\\.(css|less)$': '/spec/__mocks__/styleMock.js', '\\.(gif|ttf|eot)$': '/spec/__mocks__/fileMock.js', From ffca92e6c09132f78bd8e2f6efdceb221722389d Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Tue, 18 Aug 2020 17:41:08 -0700 Subject: [PATCH 02/11] sample stories for Label component --- .../src/components/Label/Label.test.jsx | 62 +++++++++++++++++++ .../src/components/Label/label.stories.jsx | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 superset-frontend/src/components/Label/Label.test.jsx diff --git a/superset-frontend/src/components/Label/Label.test.jsx b/superset-frontend/src/components/Label/Label.test.jsx new file mode 100644 index 000000000000..b243d209ea6f --- /dev/null +++ b/superset-frontend/src/components/Label/Label.test.jsx @@ -0,0 +1,62 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { mount } from 'enzyme'; +import { supersetTheme, ThemeProvider } from '@superset-ui/style'; +import { styledMount as mount } from 'spec/helpers/theming'; +import Label from './'; +import { + LabelGallery, + InteractiveLabel, + bsStyleKnob, +} from './Label.stories'; + +describe('Label', () => { + let wrapper; + + // test the basic component + it('renders the base component (no onClick)', () => { + console.warn('!!!!!!!') + expect(React.isValidElement(