Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({adapter: new Adapter()});
jest.mock('sulu-admin-bundle/services/Config', () => ({
endpoints: {
'config': 'config_url',
'translations': 'translations_url',
'loginCheck': 'login_check_url',
'logout': 'logout_url',
'profileSettings': 'profile_settings_url',
'forgotPasswordReset': 'forgot_password_reset_url',
'resetPassword': 'reset_password',
'resources': 'resources_url/:resource',
'routing': 'routing',
},
translations: ['en', 'de'],
fallbackLocale: 'en',
}));
import Adapter from 'enzyme-adapter-react-16'
import Enzyme from 'enzyme'
Enzyme.configure({adapter: new Adapter()})
jest.mock('react-i18next', () => ({
__esModule: true,
I18nextProvider: Component => Component.children,
// this mock makes sure any components using the translate HoC receive the t function as a prop
translate: () => Component => {
Component.defaultProps = {...Component.defaultProps, t: () => ''}
return Component
}
}))
// This is a magical file that create-react-app and jest use for boilerplate config
// https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#initializing-test-environment
import { configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
configure({ adapter: new Adapter() })
import { shallow, configure } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import React from 'react'
configure({ adapter: new Adapter() })
test('simple test', () => {
expect(shallow(<div>).type()).toBe('div')
})
</div>
import assert from 'assert'
import { configure, mount } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import * as React from 'react'
import Board from '../src/renderer/components/board/board'
configure({ adapter: new Adapter() })
describe('', () => {
describe('should be instantiable', () => {
const props = {
cards: [{
type: 'text',
id: 'imaginary-card-id',
x: 0,
y: 0,
height: 10,
width: 24,
text: ''
}],
backgroundColor: '#fff',
selected: ['imaginary-card-id']
}
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import 'jest-enzyme';
Enzyme.configure({ adapter: new Adapter() });
import React from 'react';
import ReactDOM from 'react-dom';
import Enzyme, { mount, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import {
createFakeGoogleReference,
createFakeMapInstance,
createFakeHTMLMarkerInstance,
} from '../../test/mockGoogleMaps';
import createHTMLMarker from '../elements/createHTMLMarker';
import * as utils from '../utils';
import Connected, { CustomMarker } from '../CustomMarker';
Enzyme.configure({ adapter: new Adapter() });
jest.mock('../elements/createHTMLMarker', () => jest.fn());
jest.mock('../utils');
describe('CustomMarker', () => {
const defaultProps = {
hit: {
_geoloc: {
lat: 10,
lng: 12,
},
},
};
beforeEach(() => {
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
import React from 'react';
import renderer from 'react-test-renderer';
import Adapter from 'enzyme-adapter-react-16';
import { configure, mount } from 'enzyme';
import { Table } from '../../src/components/Table';
import { sortSearchColumns, noHeaderColumns } from '../fixtures/columns';
import { data, noDataFound } from '../fixtures/data';
configure({ adapter: new Adapter() });
const MyComponent = (
}
columns={sortSearchColumns}
data={data}
exportCSV
inputColumnSearch={<input placeholder="Search column test" type="text"><input placeholder="Search table test" type="text"><table value="Export CSV test"></table>}
inputTableSearch={}
table={}
tableSearch="exact"
td={}
trHead={}
/><table><tbody><tr><td>}
th={</td><td>}
trBody={</td></tr><tr></tr><tr></tr></tbody></table>
import React from "react";
import Adapter from "enzyme-adapter-react-16";
import { configure, mount, shallow } from "enzyme";
import Editor from "./editor";
import { CSSEditor, PositionValue, SpacingType } from "./";
import { SpacingProperty } from "./spacing";
import { CSSEditorValues } from "./editor.props";
/**
* Configure Enzyme
*/
configure({ adapter: new Adapter() });
describe("CSSEditor", () => {
test("should not throw", () => {
expect(() => {
shallow();
}).not.toThrow();
});
test("should have a displayName that matches the component name", () => {
expect((Editor as any).name).toBe(Editor.displayName);
});
test("should implement the CSSPosition component", () => {
const rendered: any = mount();
expect(rendered.find("CSSPosition").length).toBe(1);
});
test("should pass all position props to the CSSPosition component", () => {