Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(Medium) - Decouple Side-Effects
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();
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