Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
return (
<div>
{this.props.children}
</div>
);
}
}
const error1 = { details: [{ name: 'a' }, { name: 'i' }] };
const error2 = { details: [{ name: 'b' }] };
const model = { a: { b: { c: 'example' } } };
const onChange = jest.fn();
const randomId = randomIds();
const state = {
changed: false,
changedMap: {},
submitting: false,
label: true,
disabled: false,
placeholder: true,
showInlineError: true,
};
const schema = new SimpleSchemaBridge({
getDefinition(name) {
// Simulate SimpleSchema.
name = name.replace(/\d+/g, '$');
return {
it('generate random id', () => {
const amount = 100;
const generator = randomIds();
const generated = Array.from({ length: amount }, generator);
const unique = generated.filter((a, b, c) => c.indexOf(a) === b);
expect(unique).toHaveLength(amount);
});
});
it('returns a function', () => {
expect(randomIds()).toBeInstanceOf(Function);
});
describe('connectField', () => {
const error = new Error();
const onChange = jest.fn();
const randomId = randomIds();
const state = {
changed: false,
changedMap: {},
submitting: false,
label: true,
disabled: false,
placeholder: false,
showInlineError: true,
};
const schema = new SimpleSchemaBridge({
getDefinition(name) {
return {
field: { type: Object, label: 'Field' },
'field.subfield': { type: Number, label: 'Subfield' },
another: { type: String, optional: true },
describe('injectName', () => {
const error = new Error();
const onChange = () => {};
const randomId = randomIds();
const state = {
changed: false,
changedMap: {},
submitting: false,
label: true,
disabled: false,
placeholder: false,
showInlineError: true,
};
const schema = new SimpleSchemaBridge({
getDefinition(name) {
return {
fieldA: { type: Object, label: 'FieldA' },
'fieldA.fieldB': { type: Object, label: 'FieldB' },
'fieldA.fieldB.fieldC': { type: String, label: 'FieldC' },