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
| 'use strict'; | |
| var most = require('most'); | |
| var Q = require('q'); | |
| var forwardFromPromisedStream = function(promise) { | |
| return most.create(function(add, end, error) { | |
| promise.then(function(stream) { | |
| stream.observe(add).then(end, error); | |
| }); |
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
| 'use strict'; | |
| var proxyquire = require('proxyquire') | |
| var should = require('should') | |
| var sinon = require('sinon') | |
| describe('ec2/doesAutoScalingGroupExist', function () { | |
| var _ | |
| var constantFunc; | |
| var ec2 |
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
| var assert = require('assert') | |
| var sinon = require('sinon') | |
| var dependency = require('dependency') | |
| var sut = require('./injection-sut') | |
| describe('sut', function () { | |
| var methodStub | |
| beforeEach(function () { | |
| methodStub = sinon.stub(dependency, 'method') |
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 got from 'got-promise'; | |
| import sample from 'lodash/collection/sample'; | |
| function serviceLookup(serviceName, routePath) { | |
| let serviceHealthUrl = `http://your.consul.host.com/v1/health/service/${serviceName}?passing`; // jshint ignore:line | |
| function composeServiceUrl(response) { | |
| let service = sample(response.body).Service; | |
| return `http://${service.Address}:${service.Port}${routePath}}}`; | |
| } |
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
| { | |
| "scripts": { | |
| "lint": "eslint --ignore-pattern=src/public/js/dist/*.js src && jscs src", | |
| "test": "mocha --compilers js:babel-register src/**/*.test.js", | |
| "dev": "wr --exec 'clear && npm run -s lint && npm run -s test' src" | |
| } | |
| } |
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 React from 'react'; | |
| import history from '../history'; | |
| function ClientAppSelect({ currentPathname }) { | |
| function handleClientSelection(event) { | |
| history.replaceState(null, event.target.value); | |
| } | |
| return ( | |
| <div> |
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
| function statelessRadio(React) { | |
| function StatelessRadio(props) { | |
| const { | |
| baseId, | |
| defaultValue, | |
| inputs = [], | |
| titleText, | |
| onSelection = () => {} | |
| } = props; |
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
| describe('StatelessRadio', () => { | |
| it('should return a function'); | |
| it('should render a wrapper div with id equal to baseId prop'); | |
| it('should render a p tag with the text from the titleText prop'); | |
| it('should render radio inputs and their labels from the inputs prop'); | |
| it('should check a default input from the defaultValue prop'); | |
| it('should take an onSelection callback prop'); | |
| }); |
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
| <div id="favorite-color"> | |
| <p id="favorite-color__title">Favorite Color</p> | |
| <input id="favorite-color-input1" name="favorite-color" type="radio" value="blue" /> | |
| <label for="favorite-color-input1">Blue</label> | |
| <input id="favorite-color-input2" name="favorite-color" type="radio" value="red" /> | |
| <label for="favorite-color-input2">Red</label> | |
| </div> |
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 assert from 'assert'; | |
| import React from 'react'; | |
| import statelessRadio from './statelessRadio'; | |
| // ... | |
| it('should return a function', () => { | |
| // "Arrange" Phase: where you do any setup or building of objects your test needs. This test is so simple it doesn't include this phase. | |
| // "Act" Phase: Perform whatever action your test tests. In this case we call our module. |