Created
September 26, 2020 12:34
-
-
Save janhesters/90b102c8d4a8865e288bdbeccc3259e1 to your computer and use it in GitHub Desktop.
Tests for home page component.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { describe } from 'riteway'; | |
import render from 'riteway/render-component.js'; | |
import HomePage from './home-page-component.js'; | |
const createProps = ({ count = 0 } = {}) => ({ count }); | |
describe('HomePage component', async assert => { | |
const createHomePage = (props = {}) => render(<HomePage {...props} />); | |
{ | |
const props = createProps(); | |
const $ = createHomePage(props); | |
assert({ | |
given: 'a count', | |
should: 'render the count', | |
actual: $('.count').text(), | |
expected: props.count.toString(), | |
}); | |
} | |
{ | |
const props = createProps({ count: 5 }); | |
const $ = createHomePage(props); | |
assert({ | |
given: 'a count', | |
should: 'render the count', | |
actual: $('.count').text(), | |
expected: props.count.toString(), | |
}); | |
} | |
{ | |
const props = createProps(); | |
const $ = createHomePage(props); | |
assert({ | |
given: 'just rendering', | |
should: 'render the increment button', | |
actual: $('.increment-button').length, | |
expected: 1, | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment