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('Allows to filter the list of posts', (assert) => {
const inMemoryDataSource = {
findPostsTitle: () => Promise.resolve(['How to bake a cake', 'How to drive a car', 'A guide to fly']),
};
const ignoreOutHowTos = (postTitle) => postTitle.indexOf('How to') !== -1;
const listOfPostTitles = ListOfPostTitles();
listOfPostTitles.setDataSource(inMemoryDataSource);
return listOfPostTitles.toHtml(ignoreOutHowTos).then((list) => {
assert.strictEqual(list, '<ul><li>A guide to fly</li></ul>');
});
});

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.