Download EPUB

(Medium) - Decouple Side-Effects

Gist 1 min read Original article

This article is too short to generate a summary.

This file contains hidden or 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

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']);
});
});

Report this article

Keep this one

14 days free, no card. Then $60 a year ($5 a month, billed yearly) or $10 a month.

Your saves stay readable and exportable, even if you stop paying.