Replace karma with jsdom + mocha + chai

* Also a bit refactoring for better testability
This commit is contained in:
Riku Rouvila
2015-07-08 20:23:48 +03:00
parent 361f18115b
commit 8ed68ff60d
8 changed files with 87 additions and 104 deletions

20
src/js/utils/renderer.js Normal file
View File

@@ -0,0 +1,20 @@
export function render(repository, commits) {
const $commits = commits.map(commit => {
return `
<li>
<span>${commit.message.replace(/\n/g, '<br />')}<span>
<br /><br />
<small>${commit.committer.name}</small>
</li>`;
});
return `
<h1>${repository.description}</h1>
<h2>
<a href="${repository.html_url}">${repository.full_name}</a>
</h2>
<ul>${$commits.join('')}</ul>
`;
}