# react-router-testing

> Testing react-router with react-router-library

Latest version **0.2.1** (published 2019-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-router-testing
pnpm add react-router-testing
yarn add react-router-testing
bun add react-router-testing
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2019-01-28 |
| First published | 2019-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Aral Roca Gomez |
| Maintainers | aralroca |

## Links

- npm: https://www.npmjs.com/package/react-router-testing
- npm.io page: https://npm.io/package/react-router-testing

## Dependencies (1)

- [history](https://npm.io/package/history.md) 4.7.2

## Recent versions

- 0.2.1 (latest) — 2019-01-28
- 0.2.0 — 2019-01-14
- 0.1.0 — 2019-01-14

## README

# React router testing


![npm version](https://img.shields.io/badge/npm-v0.2.1-blue.svg) 

*author: Aral Roca <aral-rg@hotmail.com>*

-------------------

The idea of this library is to use together with `react-testing-library`. 

Is an utility to test react-router things.

## Install

* `npm install react-router-testing --save`

# Required

* react-testing-library -> `^5.4.4`
* react -> `^16.7.0`
* react-dom -> `^16.7.0`
* react-router-dom -> `^4.3.1`

## Usage

```js
import React from 'react'
import { renderWithRouter } from 'react-router-testing'
import LinkButton from './LinkButton'

describe('LinkButton Component', () => {
  test('LinkButton is disabled meanwhile is loading', () => {
    const text = 'Some text'
    const { getByText, rerender } = renderWithRouter(
      <LinkButton text={text} />,
    )
    const LinkButtonNode = getByText(text)

    expect(LinkButtonNode.disabled).toBe(false)

    // update loading to true
    rerender(
      <LinkButton text={text} loading />,
    )

    expect(LinkButtonNode.disabled).toBe(true)

    // update loading to false
    rerender(
      <LinkButton text={text} loading={false} />,
    )

    expect(LinkButtonNode.disabled).toBe(false)
  })
})
```

---
_Source: https://npm.io/package/react-router-testing · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
