@@ -22,42 +22,42 @@ tape('bloom', (t) => {
22
22
const vector = Buffer . from ( hex , 'hex' )
23
23
24
24
const b = new Bloom ( vector )
25
- st . true ( b . check ( utils . toBuffer ( 'value 1' ) ) , 'should contain string "value 1"' )
26
- st . true ( b . check ( utils . toBuffer ( 'value 2' ) ) , 'should contain string "value 2"' )
25
+ st . true ( b . check ( Buffer . from ( 'value 1' , 'utf8 ') ) , 'should contain string "value 1"' )
26
+ st . true ( b . check ( Buffer . from ( 'value 2' , 'utf8 ') ) , 'should contain string "value 2"' )
27
27
st . end ( )
28
28
} )
29
29
30
30
t . test ( 'check shouldnt be tautology' , ( st ) => {
31
31
const b = new Bloom ( )
32
- st . false ( b . check ( utils . toBuffer ( 'random value' ) ) , 'should not contain string "random value"' )
32
+ st . false ( b . check ( Buffer . from ( 'random value' , 'utf8 ') ) , 'should not contain string "random value"' )
33
33
st . end ( )
34
34
} )
35
35
36
36
t . test ( 'should correctly add value' , ( st ) => {
37
37
const b = new Bloom ( )
38
- b . add ( utils . toBuffer ( 'value' ) )
39
- let found = b . check ( utils . toBuffer ( 'value' ) )
38
+ b . add ( Buffer . from ( 'value' , 'utf8 ') )
39
+ let found = b . check ( Buffer . from ( 'value' , 'utf8 ') )
40
40
st . true ( found , 'should contain added value' )
41
41
st . end ( )
42
42
} )
43
43
44
44
t . test ( 'should check multiple values' , ( st ) => {
45
45
const b = new Bloom ( )
46
- b . add ( utils . toBuffer ( 'value 1' ) )
47
- b . add ( utils . toBuffer ( 'value 2' ) )
48
- let found = b . multiCheck ( [ utils . toBuffer ( 'value 1' ) , utils . toBuffer ( 'value 2' ) ] )
46
+ b . add ( Buffer . from ( 'value 1' , 'utf8 ') )
47
+ b . add ( Buffer . from ( 'value 2' , 'utf8 ') )
48
+ let found = b . multiCheck ( [ Buffer . from ( 'value 1' ) , Buffer . from ( 'value 2' ) ] )
49
49
st . true ( found , 'should contain both values' )
50
50
st . end ( )
51
51
} )
52
52
53
53
t . test ( 'should or two filters' , ( st ) => {
54
54
const b1 = new Bloom ( )
55
- b1 . add ( utils . toBuffer ( 'value 1' ) )
55
+ b1 . add ( Buffer . from ( 'value 1' , 'utf8 ') )
56
56
const b2 = new Bloom ( )
57
- b2 . add ( utils . toBuffer ( 'value 2' ) )
57
+ b2 . add ( Buffer . from ( 'value 2' , 'utf8 ') )
58
58
59
59
b1 . or ( b2 )
60
- st . true ( b1 . check ( utils . toBuffer ( 'value 2' ) ) , 'should contain "value 2" after or' )
60
+ st . true ( b1 . check ( Buffer . from ( 'value 2' , 'utf-8 ') ) , 'should contain "value 2" after or' )
61
61
st . end ( )
62
62
} )
63
63
0 commit comments