All Projects → milesj → rut

milesj / rut

Licence: other
⚛️ React testing made easy. Supports DOM and custom renderers.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to rut

Squaretest
Tracks issues for the Squaretest plugin for IntelliJ IDEA
Stars: ✭ 32 (+128.57%)
Mutual labels:  unit-test
ionic-workflow-guide
Create a full and powerful worflow with Ionic (Unit Testing, Environment variables, Automatic documentation, Production App Server, Automatic deployment)
Stars: ✭ 46 (+228.57%)
Mutual labels:  unit-test
SqlInMemory
SqlInMemory is a library for creating SqlServer database on Memory instead of hard disk, at last Drops and Disposes database when you're done with it. This is useful for Integration Testing.
Stars: ✭ 24 (+71.43%)
Mutual labels:  unit-test
unittest expander
A library that provides flexible and easy-to-use tools to parameterize Python unit tests, especially those based on unittest.TestCase.
Stars: ✭ 12 (-14.29%)
Mutual labels:  unit-test
mutatest
Python mutation testing: test your tests! Safely run mutation trials without source code modifications and see what will get past your test suite.
Stars: ✭ 50 (+257.14%)
Mutual labels:  unit-test
ionic2-jest-example
Example of how to test an Ionic2 app with Jest
Stars: ✭ 43 (+207.14%)
Mutual labels:  unit-test
javascript-unit-testing-with-mocha
Unit test using Mocha and Chai
Stars: ✭ 104 (+642.86%)
Mutual labels:  unit-test
go8
Go + Postgres + Chi Router + sqlx + ent + unit testing Starter Kit for API Development
Stars: ✭ 103 (+635.71%)
Mutual labels:  unit-test
pytest-spark
pytest plugin to run the tests with support of pyspark
Stars: ✭ 65 (+364.29%)
Mutual labels:  unit-test
rut
Rut.js te ayuda a validar y formatear rut's en tus aplicaciones JavaScript
Stars: ✭ 19 (+35.71%)
Mutual labels:  rut
plugin-unit-test-demo
Sample WordPress plugin to illustrate unit tests
Stars: ✭ 17 (+21.43%)
Mutual labels:  unit-test
go-echo-boilerplate
The fastest way to build a restful API with golang and echo framework. Includes common required features for modern web applications. A boilerplate project with golang and Echo.
Stars: ✭ 53 (+278.57%)
Mutual labels:  unit-test
xrm-mock
📚 A fake implementation of the Xrm object model. Written in TypeScript against @types/xrm definitions.
Stars: ✭ 64 (+357.14%)
Mutual labels:  unit-test
torchjs
Test framework to light up the world.
Stars: ✭ 40 (+185.71%)
Mutual labels:  unit-test
js-unit-testing-interview-questions
No description or website provided.
Stars: ✭ 29 (+107.14%)
Mutual labels:  unit-test
angularjs-jest-example
✅ AngularJs with Jest example
Stars: ✭ 13 (-7.14%)
Mutual labels:  unit-test
BESTV
Android TV App powered by TMDb. It is a easy way to find the best TV content, the top movies, series... all of that in your TV.
Stars: ✭ 49 (+250%)
Mutual labels:  unit-test
tsioc
AOP, Ioc container, Boot framework, unit testing framework , activities workflow framework.
Stars: ✭ 15 (+7.14%)
Mutual labels:  unit-test
arch-mvvm-ios
MVVM Architect for iOS Application.
Stars: ✭ 62 (+342.86%)
Mutual labels:  unit-test
qiniutest
Qiniu httptest tool: qiniutest
Stars: ✭ 36 (+157.14%)
Mutual labels:  unit-test

Rut

Build Status npm version npm deps

Rut is a DOM-less React testing library that aims to be lightweight, encourage great testing practices, and reduce flakiness and code smells. It is a wrapper and abstraction around react-test-renderer that simplifies the test writing process, while doing all the hard work behind the scenes.

import { render } from 'rut-dom';
import Input, { InputProps } from '../src/Input';

describe('<Input />', () => {
  it('renders an input field', () => {
    const { root, update } = render<InputProps>(<Input name="rut" value="foo" />);

    expect(root).toHaveProp('name', 'rut');
    expect(root).toHaveValue('foo');
    expect(root).not.toBeDisabled();

    update({ disabled: true });

    expect(root).toBeDisabled();
  });
});

The rut package provides core functionality for adapters to expand upon. For example, a DOM adapter for react-dom, a mobile native adapter for react-native, or even a custom adapter unique to your application.

Features

  • Type safe by design. Test with confidence.
  • First-class async support. Wait for async calls to finish before returning a rendered result. (Experimental)
  • Deep act() integration. Let Rut do the heavy lifting.
  • Update a component with new props, children, or a completely new element.
  • Unmount a component to verify cleanup and destructor based logic.
  • Dispatch DOM level events with a mocked synthetic event (and propagation coming soon!).
  • Wrap all renders with a defined wrapping component and or React.StrictMode.
  • Apply pre-built mocks for robust and accurate testing.
  • Utilize an array of pre-built matchers for easily querying, expecting, and asserting.

Best Practices

Encourages the Arrange-Act-Assert testing pattern.

Arrange: Renders the entire component tree (instead of shallow) for a more accurate representation of your component. Requires fetches, events, contexts, and more, to be properly mocked or setup before hand.

Act: With no direct access to state or internals, it forces you to interact with your tree in the same manner your user would. Dispatch events to toggle states or execute handlers, like a form submission.

Assert: Test your expectations using pre-built matchers for common testing scenarios and patterns while avoiding implementation details.

Requirements

  • React 16.9+ (Rut v1)
  • React 17+ (Rut v2)
  • Jest or another testing framework

Documentation

https://ruttest.dev

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].