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
const assert = require('assert') | |
function getAnimals(fetch, id) { | |
return fetch('http://api.animalfarmgame.com/animals/' + id) | |
.then(response => response.json()) | |
.then(data => data.results[0]) | |
} | |
describe('getAnimals', () => { | |
it('calls fetch with the correct url', () => { |
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
const fetch = require('node-fetch') | |
const Bacon = require('baconjs') | |
function getInPortuguese(word) { | |
// Google Translate API is a paid (but dirt cheap) service. This is my key | |
// and will be disabled by the time the video is out. To generate your own, | |
// go here: https://cloud.google.com/translate/v2/getting_started | |
const apiKey = | |
'AIzaSyB4DyRHIsNhogQXmH16YKbZfR-lTXrQpq0' | |
const url = |
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
/* | |
Code examples from the article: S.O.L.I.D The first 5 priciples of Object Oriented Design with JavaScript | |
https://medium.com/@cramirez92/s-o-l-i-d-the-first-5-priciples-of-object-oriented-design-with-javascript-790f6ac9b9fa#.7uj4n7rsa | |
*/ | |
const shapeInterface = (state) => ({ | |
type: 'shapeInterface', | |
area: () => state.area(state) | |
}) |