Skip to content

Instantly share code, notes, and snippets.

@pporche87
Created April 17, 2017 23:33
Show Gist options
  • Save pporche87/b32bdabbfd4a7b5820fdfbf21bff8d4b to your computer and use it in GitHub Desktop.
Save pporche87/b32bdabbfd4a7b5820fdfbf21bff8d4b to your computer and use it in GitHub Desktop.
let expect = require ('chai').expect
let indexOf = require ('../src/indexOf')
describe('indexOf()', () => {
it('Gets the index at which the first occurrence of value is found in array', () => {
expect(indexOf([1, 2, 3, 4, 5], 5)).to.deep.equal(4)
expect(indexOf(['1', '2', '3', '4', '5'], '5')).to.deep.equal(4)
expect(indexOf([1, 2, 3, 4, 5], 7)).to.deep.equal(-1)
expect(indexOf([1, 2, 3, 4, 5], -3)).to.deep.equal(-1)
expect(indexOf([1, 2, 3, 4, 5], '3')).to.deep.equal(-1)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment