Skip to content

Instantly share code, notes, and snippets.

@piq9117
Last active August 25, 2016 03:34
Show Gist options
  • Save piq9117/bba29c20fd780c49ffc9e232136186b0 to your computer and use it in GitHub Desktop.
Save piq9117/bba29c20fd780c49ffc9e232136186b0 to your computer and use it in GitHub Desktop.
/*
You can use any testing suite and assertion library you want.
I test with mocha & chai
*/
const person = {
name: 'ken',
favoriteFood: []
}
function favoriteFood (food) {
person.favoriteFood.push(food)
}
favoriteFood('apple')
favoriteFood('ramen')
describe('personObject', () => {
it('it will add food to favoriteFood list', () => {
expect(person).to.equal({
name: 'ken',
favoriteFood: ['apple', 'ramen']
})
})
})
// This will pass! :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment