15 lines
401 B
JavaScript
15 lines
401 B
JavaScript
const expect = require('expect');
|
|
const nthElement = require('./nthElement.js');
|
|
|
|
|
|
test('nthElement is a Function', () => {
|
|
expect(nthElement).toBeInstanceOf(Function);
|
|
});
|
|
test('Returns the nth element of an array.', () => {
|
|
expect(nthElement(['a', 'b', 'c'], 1)).toBe('b')
|
|
});
|
|
test('Returns the nth element of an array.', () => {
|
|
expect(nthElement(['a', 'b', 'c'], -3)).toBe('a')
|
|
});
|
|
|