11'use strict' ;
22var should = require ( 'should' ) ;
33var assert = require ( 'assert' ) ;
4- var gutil = require ( 'gulp-util ' ) ;
4+ var Vinyl = require ( 'vinyl ' ) ;
55var iconv = require ( 'iconv-lite' ) ;
6+ var mystream = require ( 'stream' ) ;
67var es = require ( 'event-stream' ) ;
78var convertEncoding = require ( './' ) ;
89
@@ -23,7 +24,7 @@ describe('gulp-convert-encoding', function() {
2324 ( function ( ) {
2425 var stream = convertEncoding ( { to : LATIN1 } ) ;
2526
26- stream . write ( new gutil . File ( {
27+ stream . write ( new Vinyl ( {
2728 base : path . join ( __dirname , './fixtures/' ) ,
2829 cwd : __dirname ,
2930 path : path . join ( __dirname + './fixtures/1x1.png' )
@@ -45,7 +46,7 @@ describe('gulp-convert-encoding', function() {
4546 cb ( ) ;
4647 } ) ;
4748
48- stream . write ( new gutil . File ( {
49+ stream . write ( new Vinyl ( {
4950 base : __dirname ,
5051 path : __dirname + '/file.txt' ,
5152 contents : null
@@ -66,10 +67,10 @@ describe('gulp-convert-encoding', function() {
6667
6768 stream . on ( 'end' , cb ) ;
6869
69- stream . write ( new gutil . File ( {
70+ stream . write ( new Vinyl ( {
7071 base : __dirname ,
7172 path : __dirname + '/file.txt' ,
72- contents : new Buffer ( testString )
73+ contents : Buffer . from ( testString )
7374 } ) ) ;
7475
7576 stream . end ( ) ;
@@ -86,10 +87,10 @@ describe('gulp-convert-encoding', function() {
8687
8788 stream . on ( 'end' , cb ) ;
8889
89- stream . write ( new gutil . File ( {
90+ stream . write ( new Vinyl ( {
9091 base : __dirname ,
9192 path : __dirname + '/file.txt' ,
92- contents : new Buffer ( [ 0xe4 , 0xf6 , 0xfc , 0xdf ] )
93+ contents : Buffer . from ( [ 0xe4 , 0xf6 , 0xfc , 0xdf ] )
9394 } ) ) ;
9495
9596 stream . end ( ) ;
@@ -106,16 +107,16 @@ describe('gulp-convert-encoding', function() {
106107
107108 // buffer the contents
108109 file . contents . pipe ( es . wait ( function ( err , data ) {
109- assert . equal ( iconv . decode ( new Buffer ( data ) , LATIN1 ) , testString ) ;
110+ assert . equal ( iconv . decode ( Buffer . from ( data ) , LATIN1 ) , testString ) ;
110111 } ) ) ;
111112 } ) ;
112113
113114 stream . on ( 'end' , cb ) ;
114115
115- stream . write ( new gutil . File ( {
116+ stream . write ( new Vinyl ( {
116117 base : __dirname ,
117118 path : __dirname + '/file.txt' ,
118- contents : es . readArray ( [ testString ] )
119+ contents : new mystream . Readable ( { objectMode : true } ) . wrap ( es . readArray ( [ testString ] ) )
119120 } ) ) ;
120121
121122 stream . end ( ) ;
@@ -130,16 +131,16 @@ describe('gulp-convert-encoding', function() {
130131
131132 // buffer the contents
132133 file . contents . pipe ( es . wait ( function ( err , data ) {
133- assert . equal ( iconv . decode ( new Buffer ( data ) , UTF8 ) , testString ) ;
134+ assert . equal ( iconv . decode ( Buffer . from ( data ) , UTF8 ) , testString ) ;
134135 } ) ) ;
135136 } ) ;
136137
137138 stream . on ( 'end' , cb ) ;
138139
139- stream . write ( new gutil . File ( {
140+ stream . write ( new Vinyl ( {
140141 base : __dirname ,
141142 path : __dirname + '/file.txt' ,
142- contents : es . readArray ( [ new Buffer ( [ 0xe4 , 0xf6 , 0xfc , 0xdf ] ) ] )
143+ contents : new mystream . Readable ( { objectMode : true } ) . wrap ( es . readArray ( [ Buffer . from ( [ 0xe4 , 0xf6 , 0xfc , 0xdf ] ) ] ) )
143144 } ) ) ;
144145
145146 stream . end ( ) ;
0 commit comments