• Stars
    star
    106
  • Rank 317,248 (Top 7 %)
  • Language
  • Created over 8 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Examples of how to test React.js applications

Testing React Applications Examples

This repo showcases how to test various parts of a common React/Redux app using Mocha, expect and enzyme. You can see a guide using these examples over in the react-boilerplate docs!

These are the examples of a talk I held at the Vienna React.js Meetup about "Testing React.js Applications"!

Setup

  1. git clone [email protected]:mxstbr/react-testing

  2. cd react-testing

  3. npm install

Structure

examples/
├── add       # Simple example of a unit test
├── NavBar    # Redux actions and reducer tests
└── Button    # React component tests

Trying the tests

There's a bunch of commands to run different test "classes". The main command is

Run all tests

Run the entire test suite.

$ npm run test

Other commands

  • $ npm run test:function: Run the pure function tests

  • $ npm run test:actions: Run the action tests

  • $ npm run test:reducer: Run the reducer tests

  • $ npm run test:redux: Run both reducer and action tests

  • $ npm run test:component: Run the component tests

  • $ npm run test:react: Run all the redux tests and the component tests

License

The MIT License (MIT)

Copyright (c) 2016 Maximilian Stoiber

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

keystatic

First class CMS experience, TypeScript API, Markdown & YAML/JSON based, no DB
TypeScript
970
star
2

react-markings

**Markdown** in <Components/>, <Components/> in **Markdown**
JavaScript
882
star
3

manypkg

☔️ An umbrella for your monorepo
TypeScript
841
star
4

react-conf-app

React Conf 2017 Companion App - built with React Native
JavaScript
800
star
5

monorepo

📦 Thinkmill's Monorepo Style Guide
JavaScript
189
star
6

ts-gql

Write GraphQL queries with a gql tag in TypeScript -> have generated types
TypeScript
162
star
7

reacteu-app

ReactEurope TouchstoneJS Mobile App
Java
161
star
8

monorepo-starter

An example setup of how to do a monorepo, used in our monorepo 'getting started' guide
JavaScript
129
star
9

hyperterm-spacegray

Spacegray theme for hyperterm
JavaScript
81
star
10

magical-types

🔮 Document React components and other stuff typed with TypeScript magically
TypeScript
77
star
11

emery

💎 Polish for the rough parts of TypeScript
TypeScript
76
star
12

jest-expect-contain-deep

Assert deeply nested values in Jest
JavaScript
67
star
13

reacteu-api

ReactEurope KeystoneJS API Server
JavaScript
54
star
14

jest-fixtures

Use file system fixtures in Jest
JavaScript
39
star
15

design-system

🎨 Thinkmill's Design System Style Guide
31
star
16

graphql

🍇 Thinkmill's GraphQL Style Guide
31
star
17

reacteu-assets

24
star
18

changelogs-xyz

A place to see changelogs for any npm package
JavaScript
24
star
19

meetup-alternative

A free, open source, self-hosted alternative to meetup.com
JavaScript
18
star
20

graphql-ts

Type-safety for constructing GraphQL schemas in TypeScript
TypeScript
18
star
21

code-challenge

Monthly code challenges
JavaScript
17
star
22

magical-forms

TypeScript
14
star
23

keystone-forgotten-password

Keystone Password Reset Plugin for Keystone 4.0
JavaScript
13
star
24

markings

📝
TypeScript
12
star
25

keystatic-demo-landing-page

TypeScript
12
star
26

elemental-ui

TypeScript
10
star
27

pragmatic-forms

A pragmatic approach to forms in React
JavaScript
10
star
28

sydjs-keystatic

TypeScript
9
star
29

untitled-docs

📚
TypeScript
9
star
30

keystatic-demo-blog

TypeScript
8
star
31

manylicense

A node_modules license reporting tool for monorepos that use yarn workspaces.
JavaScript
8
star
32

keystatic-examples-knowledge-base

Roff
8
star
33

docsmill

TypeScript
7
star
34

react-conf-app-assets

Assets for the React Conf App
7
star
35

pyn

Rust
5
star
36

parse-toml-stream

Parse TOML files in streams chunked by [sections]
JavaScript
5
star
37

sweet-changelogs

What it says on the tin
JavaScript
4
star
38

keystatic-astro-test

TypeScript
4
star
39

node-worker

🎡 A simple, promise-based, worker framework.
JavaScript
3
star
40

built-with-keystatic

A website showcasing projects built with Keystatic.
Astro
3
star
41

auto-approve-action

A GitHub action to automatically approve(and dismiss approval) of PRs based on a condition
TypeScript
3
star
42

react-hooks

A Thinkmill guide to using React Hooks in frontent projects
TypeScript
3
star
43

keystone-experiments

JavaScript
3
star
44

badge

"Supported by Thinkmill" badge for READMEs
2
star
45

ui-performance

Testing ui performance
JavaScript
2
star
46

shed

🚲 Find all your bike shedding needs under one roof
JavaScript
2
star
47

changesets-publish-slack-action

TypeScript
2
star
48

barista-slack-integration

Slack integration to make coffee orders easy!
CSS
2
star
49

keystatic-manual-setup-demo

TypeScript
1
star
50

keystatic-starter-portfolio

TypeScript
1
star
51

keystatic-template-astro

Astro
1
star
52

eslint-config-thinkmill

Thinkmill standard code style config
1
star
53

pingpong-champion

A scoring app
JavaScript
1
star
54

heroku-buildpack-bolt

Shell
1
star
55

sftp-stream-test

Tests whether the response from an SFTP server is the same as the one from downloading a file directly with the request library.
JavaScript
1
star