Files
30-seconds-of-code/test/dropRight.test.js
2018-10-19 20:18:00 +03:00

16 lines
548 B
JavaScript

const expect = require('expect');
const {dropRight} = require('./_30s.js');
test('dropRight is a Function', () => {
expect(dropRight).toBeInstanceOf(Function);
});
test('Returns a new array with n elements removed from the right', () => {
expect(dropRight([1, 2, 3])).toEqual([1, 2]);
});
test('Returns a new array with n elements removed from the right', () => {
expect(dropRight([1, 2, 3], 2)).toEqual([1]);
});
test('Returns a new array with n elements removed from the right', () => {
expect(dropRight([1, 2, 3], 42)).toEqual([]);
});