1
1
'use strict' ;
2
2
// test compression/decompression with dictionary
3
3
4
- require ( '../common' ) ;
4
+ const common = require ( '../common' ) ;
5
5
const assert = require ( 'assert' ) ;
6
6
const zlib = require ( 'zlib' ) ;
7
7
@@ -32,6 +32,7 @@ function basicDictionaryTest() {
32
32
let output = '' ;
33
33
const deflate = zlib . createDeflate ( { dictionary : spdyDict } ) ;
34
34
const inflate = zlib . createInflate ( { dictionary : spdyDict } ) ;
35
+ inflate . setEncoding ( 'utf-8' ) ;
35
36
36
37
deflate . on ( 'data' , function ( chunk ) {
37
38
inflate . write ( chunk ) ;
@@ -45,9 +46,9 @@ function basicDictionaryTest() {
45
46
inflate . end ( ) ;
46
47
} ) ;
47
48
48
- inflate . on ( 'end' , function ( ) {
49
- assert . equal ( input , output ) ;
50
- } ) ;
49
+ inflate . on ( 'end' , common . mustCall ( function ( ) {
50
+ assert . strictEqual ( input , output ) ;
51
+ } ) ) ;
51
52
52
53
deflate . write ( input ) ;
53
54
deflate . end ( ) ;
@@ -58,6 +59,7 @@ function deflateResetDictionaryTest() {
58
59
let output = '' ;
59
60
const deflate = zlib . createDeflate ( { dictionary : spdyDict } ) ;
60
61
const inflate = zlib . createInflate ( { dictionary : spdyDict } ) ;
62
+ inflate . setEncoding ( 'utf-8' ) ;
61
63
62
64
deflate . on ( 'data' , function ( chunk ) {
63
65
if ( doneReset )
@@ -72,9 +74,9 @@ function deflateResetDictionaryTest() {
72
74
inflate . end ( ) ;
73
75
} ) ;
74
76
75
- inflate . on ( 'end' , function ( ) {
76
- assert . equal ( input , output ) ;
77
- } ) ;
77
+ inflate . on ( 'end' , common . mustCall ( function ( ) {
78
+ assert . strictEqual ( input , output ) ;
79
+ } ) ) ;
78
80
79
81
deflate . write ( input ) ;
80
82
deflate . flush ( function ( ) {
@@ -89,6 +91,7 @@ function rawDictionaryTest() {
89
91
let output = '' ;
90
92
const deflate = zlib . createDeflateRaw ( { dictionary : spdyDict } ) ;
91
93
const inflate = zlib . createInflateRaw ( { dictionary : spdyDict } ) ;
94
+ inflate . setEncoding ( 'utf-8' ) ;
92
95
93
96
deflate . on ( 'data' , function ( chunk ) {
94
97
inflate . write ( chunk ) ;
@@ -102,9 +105,9 @@ function rawDictionaryTest() {
102
105
inflate . end ( ) ;
103
106
} ) ;
104
107
105
- inflate . on ( 'end' , function ( ) {
106
- assert . equal ( input , output ) ;
107
- } ) ;
108
+ inflate . on ( 'end' , common . mustCall ( function ( ) {
109
+ assert . strictEqual ( input , output ) ;
110
+ } ) ) ;
108
111
109
112
deflate . write ( input ) ;
110
113
deflate . end ( ) ;
@@ -115,6 +118,7 @@ function deflateRawResetDictionaryTest() {
115
118
let output = '' ;
116
119
const deflate = zlib . createDeflateRaw ( { dictionary : spdyDict } ) ;
117
120
const inflate = zlib . createInflateRaw ( { dictionary : spdyDict } ) ;
121
+ inflate . setEncoding ( 'utf-8' ) ;
118
122
119
123
deflate . on ( 'data' , function ( chunk ) {
120
124
if ( doneReset )
@@ -129,9 +133,9 @@ function deflateRawResetDictionaryTest() {
129
133
inflate . end ( ) ;
130
134
} ) ;
131
135
132
- inflate . on ( 'end' , function ( ) {
133
- assert . equal ( input , output ) ;
134
- } ) ;
136
+ inflate . on ( 'end' , common . mustCall ( function ( ) {
137
+ assert . strictEqual ( input , output ) ;
138
+ } ) ) ;
135
139
136
140
deflate . write ( input ) ;
137
141
deflate . flush ( function ( ) {
0 commit comments