-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the template app to reach 100% coverage
And demo jsdom
- Loading branch information
Showing
3 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import expect from 'expect'; | ||
import React from 'react'; | ||
import describeWithDom from 'describe-with-dom'; | ||
import App from 'compo/App'; | ||
|
||
describeWithDom('index', () => { | ||
|
||
it('should render the page', () => { | ||
createAppDiv(); | ||
require('../src/index'); | ||
expect(getHtmlBody()).toContain('Hello'); | ||
}); | ||
}); | ||
|
||
function createAppDiv() { | ||
const appDiv = getDocument().createElement('div'); | ||
appDiv.setAttribute('id', 'app'); | ||
getDocument().body.appendChild(appDiv); | ||
} | ||
|
||
function getDocument() { | ||
return document.defaultView.document; | ||
} | ||
|
||
function getHtmlBody() { | ||
return getDocument().documentElement.outerHTML; | ||
} |