-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.js
More file actions
29 lines (23 loc) · 891 Bytes
/
test.js
File metadata and controls
29 lines (23 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*!
* array-initial <https://github.com/jonschlinkert/array-initial>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Licensed under the MIT License
*/
'use strict';
var should = require('should');
var initial = require('./');
describe('initial', function () {
it('should throw an error if the value passed is not an array:', function () {
(function () {
initial();
}).should.throw('array-initial expects an array as the first argument.');
});
it('should return all but the last element in the array:', function () {
initial(['a', 'b', 'c', 'd', 'e', 'f']).should.eql(['a', 'b', 'c', 'd', 'e']);
initial(['a', 'b', 'c', 'd', 'e', 'f'], 1).should.eql(['a', 'b', 'c', 'd', 'e']);
});
it('should all but the last n elements in the array:', function () {
initial(['a', 'b', 'c', 'd', 'e', 'f'], 2).should.eql(['a', 'b', 'c', 'd']);
});
});