{"id":16295114,"url":"https://github.com/wadackel/react-drip-form-test-utils","last_synced_at":"2026-04-13T08:31:51.146Z","repository":{"id":143905124,"uuid":"98202620","full_name":"wadackel/react-drip-form-test-utils","owner":"wadackel","description":"Provides useful utilities for testing react-drip-form.","archived":false,"fork":false,"pushed_at":"2017-07-25T14:09:26.000Z","size":63,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T16:20:09.367Z","etag":null,"topics":["drip-form","form","higher-order-component","hoc","react","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wadackel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-24T14:55:32.000Z","updated_at":"2019-07-16T02:15:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c70470b-87c8-4698-96df-fa802ee0b2b3","html_url":"https://github.com/wadackel/react-drip-form-test-utils","commit_stats":null,"previous_names":["tsuyoshiwada/react-drip-form-test-utils"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wadackel/react-drip-form-test-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wadackel%2Freact-drip-form-test-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wadackel%2Freact-drip-form-test-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wadackel%2Freact-drip-form-test-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wadackel%2Freact-drip-form-test-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wadackel","download_url":"https://codeload.github.com/wadackel/react-drip-form-test-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wadackel%2Freact-drip-form-test-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T06:26:45.479Z","status":"ssl_error","status_checked_at":"2026-04-13T06:26:44.645Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drip-form","form","higher-order-component","hoc","react","testing"],"created_at":"2024-10-10T20:17:39.195Z","updated_at":"2026-04-13T08:31:51.128Z","avatar_url":"https://github.com/wadackel.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-drip-form-test-utils\n\n[![Build Status](http://img.shields.io/travis/tsuyoshiwada/react-drip-form-test-utils.svg?style=flat-square)](https://travis-ci.org/tsuyoshiwada/react-drip-form-test-utils)\n[![Codecov](https://img.shields.io/codecov/c/github/tsuyoshiwada/react-drip-form-test-utils.svg?style=flat-square)](https://codecov.io/gh/tsuyoshiwada/react-drip-form-test-utils)\n[![npm version](https://img.shields.io/npm/v/react-drip-form-test-utils.svg?style=flat-square)](http://badge.fury.io/js/react-drip-form-test-utils)\n\n\u003e Provides useful utilities for testing react-drip-form.\n\nMainly provide mocks for testing components. Enjoy the testing for react-drip-form :coffee:\n\n\n## Table of Contents\n\n* [Installation](#installation)\n* [API](#api)\n  * [mockContext(context = {})](#mockcontextcontext--)\n  * [mockFormProps(props = {})](#mockformpropsprops--)\n  * [mockFieldProps(props = {})](#mockfieldpropsprops--)\n  * [mockGroupProps(props = {})](#mockgrouppropsprops--)\n* [Related projects](#related-projects)\n* [Contribute](#contribute)\n* [License](#license)\n\n\n\n\n## Installation\n\nYou can install stable version at npm.\n\n```bash\n$ npm install --save-dev react-drip-form-test-utils\n```\n\n\n\n\n## API\n\n\n### mockContext(context = {})\n\nCreate mock of Context provided by `dripForm()`.\n\n```javascript\nimport { mockContext } from 'react-drip-form-test-utils';\n\nconst context = mockContext({\n  originalContext: 'original',\n  values: { foo: 'bar' },\n  dirties: ['foo'],\n});\n\nexpect(context).toEqual({\n  originalContext: 'original', // add context\n  dripForm: true,\n  group: null,\n  register: noop,\n  unregister: noop,\n  updateValue: noop,\n  updateTouched: noop,\n  updateDirty: noop,\n  updateValidations: noop,\n  updateNormalizers: noop,\n  updateMessages: noop,\n  updateLabel: noop,\n  validating: [],\n  values: { foo: 'bar' }, // override\n  errors: {},\n  touches: [],\n  dirties: ['foo'], // override\n});\n```\n\n\n### mockFormProps(props = {})\n\nCreate a Props mock that is provided when wrapping a component with `dripForm()`.  \nI'ts useful for `handlers` testing etc.\n\n```javascript\nimport { mockFormProps } from 'react-drip-form-test-utils';\n\nconst onSubmit = jest.fn();\n\nconst props = mockFormProps({\n  customProp: 'foo',\n  values: { bar: 'baz' },\n  meta: {\n    touched: true,\n    untouched: false,\n  },\n  handlers: {\n    onSubmit,\n  },\n});\n\nexpect(props).toEqual({\n  customProp: 'foo', // add props\n  values: { bar: 'baz' }, // override\n  errors: {},\n  meta: {\n    valid: false,\n    invalid: true,\n    touched: true, // override\n    untouched: false, // override\n    dirty: false,\n    pristine: true,\n    validating: false,\n  },\n  fields: {\n    get: noop,\n    set: noop,\n    remove: noop,\n    push: noop,\n    pop: noop,\n    shift: noop,\n    unshift: noop,\n    swap: noop,\n    move: noop,\n    map: noop,\n    forEach: noop,\n    isValid: noop,\n    isValidating: noop,\n  },\n  handlers: {\n    onSubmit: onSubmit, // jest mock\n    onClear: noop,\n    onReset: noop,\n  },\n});\n```\n\n\n### mockFieldProps(props = {})\n\nCreate a Props mock that is provided when wrapping a component with `dripFormField()`.\n\n```javascript\nimport { mockFieldProps } from 'react-drip-form-test-utils';\n\nconst onChange = jest.fn();\n\nconst props = mockFieldProps({\n  customProp: 'foo',\n  input: {\n    onChange,\n  },\n  meta: {\n    error: 'Error!!',\n  },\n});\n\nexpect(props).toEqual({\n  customProp: 'foo', // add props\n  input: {\n    name: 'mockField',\n    value: null,\n    onChange: onChange, // jest mock\n    onFocus: noop,\n    onBlur: noop,\n  },\n  meta: {\n    label: null,\n    error: 'Error!!', // override\n    errors: [],\n    valid: false,\n    invalid: true,\n    touched: false,\n    untouched: true,\n    dirty: false,\n    pristine: true,\n    validating: false,\n  },\n});\n```\n\n\n### mockGroupProps(props = {})\n\nCreate a Props mock that is provided when wrapping a component with `dripFormGroup()`.\n\n```javascript\nimport { mockGroupProps } from 'react-drip-form-test-utils';\n\nconst props = mockGroupProps({\n  customProp: true,\n  meta: {\n    label: 'Foo',\n    valid: true,\n    invalid: false,\n  },\n});\n\nexpect(props).toEqual({\n  customProp: true, // add props\n  meta: {\n    name: 'mockGroup',\n    value: null,\n    label: 'Foo', // override\n    error: null,\n    errors: [],\n    valid: true, // override\n    invalid: false, // override\n    touched: false,\n    untouched: true,\n    dirty: false,\n    pristine: true,\n    validating: false,\n    ...(props.meta || {}),\n  },\n});\n```\n\n\n## Related projects\n\n* [tsuyoshiwada/react-drip-form](https://github.com/tsuyoshiwada/react-drip-form)\n\n\n\n\n## Contribute\n\n1. Fork it!\n1. Create your feature branch: git checkout -b my-new-feature\n1. Commit your changes: git commit -am 'Add some feature'\n1. Push to the branch: git push origin my-new-feature\n1. Submit a pull request :D\n\nBugs, feature requests and comments are more than welcome in the [issues](https://github.com/tsuyoshiwada/react-drip-form-test-utils/issues).\n\n\n\n\n## License\n\n[MIT © tsuyoshiwada](./LICENSE)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwadackel%2Freact-drip-form-test-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwadackel%2Freact-drip-form-test-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwadackel%2Freact-drip-form-test-utils/lists"}