Last active
July 15, 2018 00:28
-
-
Save FagnerMartinsBrack/17b08c36320a189b56e32e1b4704508d to your computer and use it in GitHub Desktop.
(Medium) - Decouple Side-Effects
This file contains 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>'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment