Last active
November 4, 2016 14:27
-
-
Save thiagoa/c9aff6f6cfba4c1b32dc144574ea8310 to your computer and use it in GitHub Desktop.
Example function to render a cart's total on the screen
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
import { expect } from 'chai'; | |
import createFixture from '../support/createFixture'; | |
function renderCartTotal({ domNode, itemPrices }) { | |
const sum = itemPrices.reduce((total, price) => total + price, 0); | |
const formattedPrice = `$${sum}`; | |
domNode.innerHTML = formattedPrice; | |
} | |
// Rest of the spec file here... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment