24
1
describe('Array', function () {
2
beforeEach(function () {
3
this.ary = [1, 2, 3];
4
});
5
describe('#indexOf()', function () {
6
it('should return index when the value is present', function () {
7
var zero = 0, two = 2;
8
assert(this.ary.indexOf(zero) === two);
9
});
10
it('should return -1 when the value is not present', function () {
11
var minusOne = -1, two = 2;
12
assert.ok(this.ary.indexOf(two) === minusOne, 'THIS IS AN ASSERTION MESSAGE');
13
});
14
});
15
});
16
17
describe('String.slice()', function () {
18
it('extracts a section of a string and returns a new string', function () {
19
var str1 = "The morning is upon us.";
20
var str2 = str1.slice(4, -2);
21
assert(str1 === str2);
22
});
23
});
24