Skip to content

Instantly share code, notes, and snippets.

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/3430c17fb8b2cadde834c70f9b9eb031 to your computer and use it in GitHub Desktop.
Save FagnerMartinsBrack/3430c17fb8b2cadde834c70f9b9eb031 to your computer and use it in GitHub Desktop.
(Medium) - Decouple Side-Effects
QUnit.test('Query the posts title given some HTML server response', (assert) => {
const getRequest = (url) => {
return Promise.resolve(`
<section>
<h1 class="post-title">How to bake a cake</h1>
</section>
`);
};
const httpServerDataSource = HttpServerDataSource(getRequest);
return httpServerDataSource.findPostsTitle().then((postsTitle) => {
assert.deepEqual(postsTitle, ['How to bake a cake']);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment