(Medium) - Decouple Side-Effects
View original- current
This article is too short to summarise.
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>'); | |
| }); | |
| }); |