mirror of
https://github.com/apache/superset.git
synced 2026-04-21 00:54:44 +00:00
test(frontend): use absolute path for src imports (#9761)
* test(frontend): use absolute path for src imports * Upgrade prettier, fix eslint
This commit is contained in:
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import Toast from 'src/messageToasts/components/Toast';
|
||||
import ToastPresenter from 'src/messageToasts/components/ToastPresenter';
|
||||
|
||||
import mockMessageToasts from '../mockMessageToasts';
|
||||
import Toast from '../../../../src/messageToasts/components/Toast';
|
||||
import ToastPresenter from '../../../../src/messageToasts/components/ToastPresenter';
|
||||
|
||||
describe('ToastPresenter', () => {
|
||||
const props = {
|
||||
@@ -47,11 +47,6 @@ describe('ToastPresenter', () => {
|
||||
it('should pass removeToast to the Toast component', () => {
|
||||
const removeToast = () => {};
|
||||
const wrapper = setup({ removeToast });
|
||||
expect(
|
||||
wrapper
|
||||
.find(Toast)
|
||||
.first()
|
||||
.prop('onCloseToast'),
|
||||
).toBe(removeToast);
|
||||
expect(wrapper.find(Toast).first().prop('onCloseToast')).toBe(removeToast);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
import { Alert } from 'react-bootstrap';
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Toast from 'src/messageToasts/components/Toast';
|
||||
|
||||
import mockMessageToasts from '../mockMessageToasts';
|
||||
import Toast from '../../../../src/messageToasts/components/Toast';
|
||||
|
||||
describe('Toast', () => {
|
||||
const props = {
|
||||
@@ -43,12 +43,7 @@ describe('Toast', () => {
|
||||
const wrapper = setup();
|
||||
const alert = wrapper.find(Alert);
|
||||
|
||||
expect(
|
||||
alert
|
||||
.childAt(0)
|
||||
.childAt(1)
|
||||
.text(),
|
||||
).toBe(props.toast.text);
|
||||
expect(alert.childAt(0).childAt(1).text()).toBe(props.toast.text);
|
||||
});
|
||||
|
||||
it('should call onCloseToast upon alert dismissal', done => {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { INFO_TOAST, DANGER_TOAST } from '../../../src/messageToasts/constants';
|
||||
import { INFO_TOAST, DANGER_TOAST } from 'src/messageToasts/constants';
|
||||
|
||||
export default [
|
||||
{ id: 'info_id', toastType: INFO_TOAST, text: 'info toast' },
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { ADD_TOAST, REMOVE_TOAST } from '../../../../src/messageToasts/actions';
|
||||
import messageToastsReducer from '../../../../src/messageToasts/reducers';
|
||||
import { ADD_TOAST, REMOVE_TOAST } from 'src/messageToasts/actions';
|
||||
import messageToastsReducer from 'src/messageToasts/reducers';
|
||||
|
||||
describe('messageToasts reducer', () => {
|
||||
it('should return initial state', () => {
|
||||
|
||||
@@ -20,9 +20,9 @@ import {
|
||||
DANGER_TOAST,
|
||||
INFO_TOAST,
|
||||
SUCCESS_TOAST,
|
||||
} from '../../../../src/messageToasts/constants';
|
||||
} from 'src/messageToasts/constants';
|
||||
|
||||
import getToastsFromPyFlashMessages from '../../../../src/messageToasts/utils/getToastsFromPyFlashMessages';
|
||||
import getToastsFromPyFlashMessages from 'src/messageToasts/utils/getToastsFromPyFlashMessages';
|
||||
|
||||
describe('getToastsFromPyFlashMessages', () => {
|
||||
it('should return an info toast', () => {
|
||||
|
||||
Reference in New Issue
Block a user