forked from iliakan/javascript-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
26 lines (22 loc) · 930 Bytes
/
test.js
File metadata and controls
26 lines (22 loc) · 930 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
describe("find", function() {
describe("возвращает позицию, на которой найден элемент", function() {
it("в массиве [1,2,3] находит 1 на позиции 0", function() {
assert.equal(find([1, 2, 3], 1), 0);
});
it("в массиве [1,2,3] находит 2 на позиции 1", function() {
assert.equal(find([1, 2, 3], 2), 1);
});
it("в массиве [1,2,3] находит 3 на позиции 2", function() {
assert.equal(find([1, 2, 3], 3), 2);
});
});
it("если элемент не найден, возвращает -1", function() {
assert.equal(find([1, 2, 3], 0), -1);
});
it("отличает false или null от 0", function() {
assert.equal(find([false, true, null], 0), -1);
});
it("отличает 1 от true", function() {
assert.equal(find([1, 2, 3], true), -1);
});
});