Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should renders correctly', () => {
const renderer = ShallowRenderer.createRenderer();
const props = {
isLoading: false,
pastDelay: false,
timedOut: false,
error: null,
retry: () => { return; },
};
const result = renderer.render(
,
);
expect(result).toMatchSnapshot();
renderer.unmount();
});
});
it("renders stream container", () => {
const data = {
props: {
story: {},
} as any,
error: null,
};
const renderer = createRenderer();
renderer.render(React.createElement(() => render(data, "CREATED_AT_ASC")));
expect(renderer.getRenderOutput()).toMatchSnapshot();
});
it("renders correctly", () => {
const props: PropTypesOf = {
story: {},
viewer: {},
settings: {},
};
const renderer = createRenderer();
renderer.render();
expect(renderer.getRenderOutput()).toMatchSnapshot();
});
it("renders correctly", () => {
const props: PropTypesOf = {
children: "child",
gutterBegin: true,
gutterEnd: true,
className: "custom",
};
const renderer = createRenderer();
renderer.render();
expect(renderer.getRenderOutput()).toMatchSnapshot();
});
import { default as React } from 'react'
import { createRenderer } from 'react-test-renderer/shallow'
import { default as expect } from 'expect'
import { default as CubeGrid } from '..'
import { default as Base } from '../../Base'
const renderer = createRenderer()
describe('CubeGrid', () => {
let tree
beforeEach(() => {
renderer.render()
tree = renderer.getRenderOutput()
})
it('renders a container', () => {
expect(tree.type).toEqual(Base)
})
})
it('reactElementToJSXString(decorator(<span>)', () => {
function myDecorator(ComposedComponent) {
class MyDecorator extends React.Component {
render() {
return (
<div>{React.createElement(ComposedComponent.type, this.props)}</div>
);
}
}
MyDecorator.displayName = `${ComposedComponent.name}-Decorated`;
return MyDecorator;
}
const NestedSpan = myDecorator(<span>);
const renderer = createRenderer();
renderer.render();
expect(reactElementToJSXString(renderer.getRenderOutput())).toEqual(
`<div>
<span>
</span></div>`
);
});
</span></span>
it("renders loading", () => {
const data = {
props: null,
error: null,
};
const renderer = createRenderer();
renderer.render(React.createElement(() => render(data)));
expect(renderer.getRenderOutput()).toMatchSnapshot();
});
it("renders correctly", () => {
const props: PropTypesOf = {
className: "root",
dotted: true,
};
const renderer = createRenderer();
renderer.render(
const setup = propOverrides => {
const props = Object.assign(
{
onSave: jest.fn(),
text: 'Use Redux',
placeholder: 'What needs to be done?',
editing: false,
newTodo: false,
},
propOverrides
)
const renderer = createRenderer()
renderer.render()
const output = renderer.getRenderOutput()
return {
props: props,
output: output,
renderer: renderer,
}
}
completed: true,
id: 1
}
],
actions: {
editTodo: jest.fn(),
deleteTodo: jest.fn(),
completeTodo: jest.fn(),
completeAll: jest.fn(),
clearCompleted: jest.fn()
}
},
propOverrides
);
const renderer = createRenderer();
renderer.render();
const output = renderer.getRenderOutput();
return {
props,
output,
renderer
};
};