1
1
'use strict' ;
2
- var common = require ( '../common' ) ;
3
- var assert = require ( 'assert' ) ;
2
+ const common = require ( '../common' ) ;
3
+ const assert = require ( 'assert' ) ;
4
4
5
- var path = require ( 'path' ) ;
6
- var fs = require ( 'fs' ) ;
7
- var fn = path . join ( common . fixturesDir , 'elipses.txt' ) ;
8
- var rangeFile = path . join ( common . fixturesDir , 'x.txt' ) ;
5
+ const path = require ( 'path' ) ;
6
+ const fs = require ( 'fs' ) ;
7
+ const fn = path . join ( common . fixturesDir , 'elipses.txt' ) ;
8
+ const rangeFile = path . join ( common . fixturesDir , 'x.txt' ) ;
9
9
10
10
var callbacks = { open : 0 , end : 0 , close : 0 } ;
11
11
@@ -20,7 +20,7 @@ assert.strictEqual(file.bytesRead, 0);
20
20
file . on ( 'open' , function ( fd ) {
21
21
file . length = 0 ;
22
22
callbacks . open ++ ;
23
- assert . equal ( 'number' , typeof fd ) ;
23
+ assert . strictEqual ( 'number' , typeof fd ) ;
24
24
assert . strictEqual ( file . bytesRead , 0 ) ;
25
25
assert . ok ( file . readable ) ;
26
26
@@ -67,12 +67,12 @@ file.on('close', function() {
67
67
var file3 = fs . createReadStream ( fn , { encoding : 'utf8' } ) ;
68
68
file3 . length = 0 ;
69
69
file3 . on ( 'data' , function ( data ) {
70
- assert . equal ( 'string' , typeof data ) ;
70
+ assert . strictEqual ( 'string' , typeof data ) ;
71
71
file3 . length += data . length ;
72
72
73
73
for ( var i = 0 ; i < data . length ; i ++ ) {
74
74
// http://www.fileformat.info/info/unicode/char/2026/index.htm
75
- assert . equal ( '\u2026' , data [ i ] ) ;
75
+ assert . strictEqual ( '\u2026' , data [ i ] ) ;
76
76
}
77
77
} ) ;
78
78
@@ -81,11 +81,11 @@ file3.on('close', function() {
81
81
} ) ;
82
82
83
83
process . on ( 'exit' , function ( ) {
84
- assert . equal ( 1 , callbacks . open ) ;
85
- assert . equal ( 1 , callbacks . end ) ;
86
- assert . equal ( 2 , callbacks . close ) ;
87
- assert . equal ( 30000 , file . length ) ;
88
- assert . equal ( 10000 , file3 . length ) ;
84
+ assert . strictEqual ( 1 , callbacks . open ) ;
85
+ assert . strictEqual ( 1 , callbacks . end ) ;
86
+ assert . strictEqual ( 2 , callbacks . close ) ;
87
+ assert . strictEqual ( 30000 , file . length ) ;
88
+ assert . strictEqual ( 10000 , file3 . length ) ;
89
89
console . error ( 'ok' ) ;
90
90
} ) ;
91
91
@@ -95,7 +95,7 @@ file4.on('data', function(data) {
95
95
contentRead += data . toString ( 'utf-8' ) ;
96
96
} ) ;
97
97
file4 . on ( 'end' , function ( data ) {
98
- assert . equal ( contentRead , 'yz' ) ;
98
+ assert . strictEqual ( contentRead , 'yz' ) ;
99
99
} ) ;
100
100
101
101
var file5 = fs . createReadStream ( rangeFile , { bufferSize : 1 , start : 1 } ) ;
@@ -104,7 +104,7 @@ file5.on('data', function(data) {
104
104
file5 . data += data . toString ( 'utf-8' ) ;
105
105
} ) ;
106
106
file5 . on ( 'end' , function ( ) {
107
- assert . equal ( file5 . data , 'yz\n' ) ;
107
+ assert . strictEqual ( file5 . data , 'yz\n' ) ;
108
108
} ) ;
109
109
110
110
// https://github.com/joyent/node/issues/2320
@@ -114,7 +114,7 @@ file6.on('data', function(data) {
114
114
file6 . data += data . toString ( 'utf-8' ) ;
115
115
} ) ;
116
116
file6 . on ( 'end' , function ( ) {
117
- assert . equal ( file6 . data , 'yz\n' ) ;
117
+ assert . strictEqual ( file6 . data , 'yz\n' ) ;
118
118
} ) ;
119
119
120
120
assert . throws ( function ( ) {
@@ -129,7 +129,7 @@ stream.on('data', function(chunk) {
129
129
} ) ;
130
130
131
131
stream . on ( 'end' , function ( ) {
132
- assert . equal ( 'x' , stream . data ) ;
132
+ assert . strictEqual ( 'x' , stream . data ) ;
133
133
} ) ;
134
134
135
135
// pause and then resume immediately.
@@ -155,7 +155,7 @@ function file7Next() {
155
155
file7 . data += data ;
156
156
} ) ;
157
157
file7 . on ( 'end' , function ( err ) {
158
- assert . equal ( file7 . data , 'xyz\n' ) ;
158
+ assert . strictEqual ( file7 . data , 'xyz\n' ) ;
159
159
} ) ;
160
160
}
161
161
0 commit comments