11'use strict' ;
22// test compression/decompression with dictionary
33
4- require ( '../common' ) ;
4+ const common = require ( '../common' ) ;
55const assert = require ( 'assert' ) ;
66const zlib = require ( 'zlib' ) ;
77
@@ -32,6 +32,7 @@ function basicDictionaryTest() {
3232 let output = '' ;
3333 const deflate = zlib . createDeflate ( { dictionary : spdyDict } ) ;
3434 const inflate = zlib . createInflate ( { dictionary : spdyDict } ) ;
35+ inflate . setEncoding ( 'utf-8' ) ;
3536
3637 deflate . on ( 'data' , function ( chunk ) {
3738 inflate . write ( chunk ) ;
@@ -45,9 +46,9 @@ function basicDictionaryTest() {
4546 inflate . end ( ) ;
4647 } ) ;
4748
48- inflate . on ( 'end' , function ( ) {
49- assert . equal ( input , output ) ;
50- } ) ;
49+ inflate . on ( 'end' , common . mustCall ( function ( ) {
50+ assert . strictEqual ( input , output ) ;
51+ } ) ) ;
5152
5253 deflate . write ( input ) ;
5354 deflate . end ( ) ;
@@ -58,6 +59,7 @@ function deflateResetDictionaryTest() {
5859 let output = '' ;
5960 const deflate = zlib . createDeflate ( { dictionary : spdyDict } ) ;
6061 const inflate = zlib . createInflate ( { dictionary : spdyDict } ) ;
62+ inflate . setEncoding ( 'utf-8' ) ;
6163
6264 deflate . on ( 'data' , function ( chunk ) {
6365 if ( doneReset )
@@ -72,9 +74,9 @@ function deflateResetDictionaryTest() {
7274 inflate . end ( ) ;
7375 } ) ;
7476
75- inflate . on ( 'end' , function ( ) {
76- assert . equal ( input , output ) ;
77- } ) ;
77+ inflate . on ( 'end' , common . mustCall ( function ( ) {
78+ assert . strictEqual ( input , output ) ;
79+ } ) ) ;
7880
7981 deflate . write ( input ) ;
8082 deflate . flush ( function ( ) {
@@ -89,6 +91,7 @@ function rawDictionaryTest() {
8991 let output = '' ;
9092 const deflate = zlib . createDeflateRaw ( { dictionary : spdyDict } ) ;
9193 const inflate = zlib . createInflateRaw ( { dictionary : spdyDict } ) ;
94+ inflate . setEncoding ( 'utf-8' ) ;
9295
9396 deflate . on ( 'data' , function ( chunk ) {
9497 inflate . write ( chunk ) ;
@@ -102,9 +105,9 @@ function rawDictionaryTest() {
102105 inflate . end ( ) ;
103106 } ) ;
104107
105- inflate . on ( 'end' , function ( ) {
106- assert . equal ( input , output ) ;
107- } ) ;
108+ inflate . on ( 'end' , common . mustCall ( function ( ) {
109+ assert . strictEqual ( input , output ) ;
110+ } ) ) ;
108111
109112 deflate . write ( input ) ;
110113 deflate . end ( ) ;
@@ -115,6 +118,7 @@ function deflateRawResetDictionaryTest() {
115118 let output = '' ;
116119 const deflate = zlib . createDeflateRaw ( { dictionary : spdyDict } ) ;
117120 const inflate = zlib . createInflateRaw ( { dictionary : spdyDict } ) ;
121+ inflate . setEncoding ( 'utf-8' ) ;
118122
119123 deflate . on ( 'data' , function ( chunk ) {
120124 if ( doneReset )
@@ -129,9 +133,9 @@ function deflateRawResetDictionaryTest() {
129133 inflate . end ( ) ;
130134 } ) ;
131135
132- inflate . on ( 'end' , function ( ) {
133- assert . equal ( input , output ) ;
134- } ) ;
136+ inflate . on ( 'end' , common . mustCall ( function ( ) {
137+ assert . strictEqual ( input , output ) ;
138+ } ) ) ;
135139
136140 deflate . write ( input ) ;
137141 deflate . flush ( function ( ) {
0 commit comments