Skip to content

React tests#23

Open
beaucollins wants to merge 3 commits intoFlatFilers:masterfrom
beaucollins:effect-hook
Open

React tests#23
beaucollins wants to merge 3 commits intoFlatFilers:masterfrom
beaucollins:effect-hook

Conversation

@beaucollins
Copy link

@beaucollins beaucollins commented Jan 15, 2021

In preparation for fixing #22 this sets up tests for the existing implementation.

Switches from enzyme to use @testing-library/react which is designed to be able to test component behavior that relies on hooks (like React.useEffect).

How to Test

npm test
 PASS  src/components/FlatfileButton.test.tsx
  <FlatfileButton settings={testSettings} />
    ✓ renders button (69 ms)
    ✓ calls requestDataFromUser when button is clicked (9 ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        1.4 s, estimated 3 s
Ran all test suites.

Coverage

--------------------|---------|----------|---------|---------|----------------------------------
File                | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                
--------------------|---------|----------|---------|---------|----------------------------------
All files           |   72.55 |    30.77 |   44.44 |   71.43 |                                  
 FlatFileButton.tsx |   72.55 |    30.77 |   44.44 |   71.43 | 62,66-67,71,74-84,95-102,107,111 
--------------------|---------|----------|---------|---------|----------------------------------

- Uncomment test and use testing-library/react
- Add test for button click behavior
@beaucollins beaucollins changed the title React tests and lint fixes React tests Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant