-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.js
27 lines (23 loc) · 811 Bytes
/
test.js
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
'use strict';
/*!
* array-slice <https://github.com/jonschlinkert/array-slice>
*
* Copyright (c) 2014-2015, 2017, Jon Schlinkert.
* Released under the MIT License.
*/
require('mocha');
var assert = require('assert');
var slice = require('./');
describe('array-slice:', function() {
it('should return the specified range.', function() {
var arr = ['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
assert.deepEqual(slice(arr, 3, 6), ['e', 'f', 'g']);
assert.deepEqual(slice(arr, 1), ['b', 'd', 'e', 'f', 'g', 'h', 'i', 'j']);
assert.deepEqual(slice(arr, -1), ['j']);
});
it('should not mutate the array', function() {
var arr = ['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
slice(arr, 3, 6);
assert.deepEqual(arr, ['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j']);
});
});