Skip to content

Commit bbe154b

Browse files
committed
Test fixes
1 parent f224adb commit bbe154b

File tree

2 files changed

+11
-31
lines changed

2 files changed

+11
-31
lines changed

test/collectors.js

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ test('Multiple collectors order', function(t) {
1717
var collector1 = dop.collect()
1818
var collector2 = dop.collect()
1919
object.array.push(Math.random())
20-
t.equal(collector1.mutations.length, 0)
21-
t.equal(collector2.mutations.length, 1)
20+
t.equal(collector1.mutations.length, 1)
21+
t.equal(collector2.mutations.length, 0)
2222
collector1.destroy()
2323
collector2.destroy()
2424
t.end()
2525
})
2626

27-
test('Using index_function', function(t) {
27+
test('Using collectFirst', function(t) {
2828
var collector1 = dop.collect()
2929
var collector2 = dop.collect(function() {
3030
return 0
@@ -37,8 +37,8 @@ test('Using index_function', function(t) {
3737
})
3838
object.array.push(Math.random())
3939
t.equal(collector1.mutations.length, 0)
40-
t.equal(collector2.mutations.length, 1)
41-
t.equal(collector3.mutations.length, 1)
40+
t.equal(collector2.mutations.length, 2)
41+
t.equal(collector3.mutations.length, 0)
4242
t.equal(collector4.mutations.length, 1)
4343
collector1.destroy()
4444
collector2.destroy()
@@ -47,26 +47,6 @@ test('Using index_function', function(t) {
4747
t.end()
4848
})
4949

50-
test('Using index_function 2', function(t) {
51-
var collector2 = dop.collect(function() {
52-
return 0
53-
})
54-
object.array.push(Math.random())
55-
var collector3 = dop.collect()
56-
object.array.push(Math.random())
57-
var collector4 = dop.collect(function(collectors) {
58-
return collectors.length
59-
})
60-
object.array.push(Math.random())
61-
t.equal(collector2.mutations.length, 1)
62-
t.equal(collector3.mutations.length, 2)
63-
t.equal(collector4.mutations.length, 0)
64-
collector2.destroy()
65-
collector3.destroy()
66-
collector4.destroy()
67-
t.end()
68-
})
69-
7050
test('Active and inactive collectores', function(t) {
7151
var collector1 = dop.collect()
7252
object.array.push(Math.random())
@@ -76,8 +56,8 @@ test('Active and inactive collectores', function(t) {
7656
object.array.push(Math.random())
7757
collector1.active = true
7858
object.array.push(Math.random())
79-
t.equal(collector1.mutations.length, 1)
80-
t.equal(collector2.mutations.length, 3)
59+
t.equal(collector1.mutations.length, 3)
60+
t.equal(collector2.mutations.length, 1)
8161
collector1.destroy()
8262
collector2.destroy()
8363
t.end()
@@ -90,8 +70,8 @@ test('Destroying', function(t) {
9070
object.array.push(Math.random())
9171
collector1.destroy()
9272
object.array.push(Math.random())
93-
t.equal(collector1.mutations.length, 1)
94-
t.equal(collector2.mutations.length, 2)
73+
t.equal(collector1.mutations.length, 2)
74+
t.equal(collector2.mutations.length, 1)
9575
collector1.destroy()
9676
collector2.destroy()
9777
t.end()
@@ -113,8 +93,8 @@ test('Filtering', function(t) {
11393
t.equal(collector2.mutations.length, 2)
11494
delete collector1.filter
11595
object.array.push(Math.random())
116-
t.equal(collector1.mutations.length, 1)
117-
t.equal(collector2.mutations.length, 3)
96+
t.equal(collector1.mutations.length, 2)
97+
t.equal(collector2.mutations.length, 2)
11898
collector1.destroy()
11999
collector2.destroy()
120100
t.end()

0 commit comments

Comments
 (0)