Skip to content

Instantly share code, notes, and snippets.

@FagnerMartinsBrack
Last active July 16, 2018 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FagnerMartinsBrack/f330e14fea0c85649de086b65a9b3297 to your computer and use it in GitHub Desktop.
Save FagnerMartinsBrack/f330e14fea0c85649de086b65a9b3297 to your computer and use it in GitHub Desktop.
(Medium) - Decouple Side-Effects
QUnit.test('Create a list of one post', (assert) => {
const getRequest = (url) => {
return Promise.resolve(`
<section>
<h1 class="post-title">How to bake a cake</h1>
</section>
`);
};
const httpServerDataSource = HttpServerDataSource(getRequest);
const listOfPostTitles = ListOfPostTitles();
listOfPostTitles.setDataSource(httpServerDataSource);
return listOfPostTitles.toHtml().then((list) => {
assert.strictEqual(list, '<ul><li>How to bake a cake</li></ul>');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment