Skip to content

Commit

Permalink
test: get the tests to work and add a test for the initial state of t…
Browse files Browse the repository at this point in the history
…he color palette table
  • Loading branch information
dylanb committed Mar 26, 2018
1 parent 82b2237 commit 2fa4f40
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 70 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
## Color Palette Contrast Analyzer

## Contributing

On Mac OS X, you will likely need watchman to be installed in order to get `yarn test` to run. Use Homwbrew to install watchman with `brew install watchman`.
14 changes: 7 additions & 7 deletions src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'

it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
const div = document.createElement('div')
ReactDOM.render(<App />, div)
ReactDOM.unmountComponentAtNode(div)
})
10 changes: 10 additions & 0 deletions src/color-palette.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import ReactDOM from 'react-dom'
import ColorPalette from './color-palette'

test('should render a paragraph if there are no colors', () => {
const div = document.createElement('div')
ReactDOM.render(<ColorPalette />, div)
expect(div.querySelectorAll('p')).toBeDefined()
ReactDOM.unmountComponentAtNode(div)
})
6 changes: 6 additions & 0 deletions src/setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const localStorageMock = {
getItem: jest.fn(),
setItem: jest.fn(),
clear: jest.fn()
};
global.localStorage = localStorageMock
Loading

0 comments on commit 2fa4f40

Please sign in to comment.