Skip to content

Instantly share code, notes, and snippets.

@thiagoa
Last active November 4, 2016 14:27
Show Gist options
  • Save thiagoa/c9aff6f6cfba4c1b32dc144574ea8310 to your computer and use it in GitHub Desktop.
Save thiagoa/c9aff6f6cfba4c1b32dc144574ea8310 to your computer and use it in GitHub Desktop.
Example function to render a cart's total on the screen
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