Skip to content

Commit ec2a3cb

Browse files
committed
Tidy up tests and code.
- Add Content-Type meta tag to test document Manual tests could have utf8 difficulties without it because browsers could interpet strings as other encodings. - Fix test naming to be more clear. - Tidy up code: remove tmp variable.
1 parent a43dbe3 commit ec2a3cb

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

gulpfile.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ gulp.task('build-browser-test', function(){
7979
})
8080
.on('error', gutil.log)
8181
.pipe(source('neo4j-web.test.js'))
82-
.pipe(buffer())
83-
.pipe(uglify())
8482
.pipe(gulp.dest(browserOutput))
8583
},
8684
function(cb) {

lib/internal/utf8.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ try {
9090

9191
let streamDecodeCombinedBuffer = (combinedBuffers, length, decodeFn, endFn) => {
9292
let remainingBytesToRead = length;
93+
// Reduce CombinedBuffers to a decoded string
9394
let out = combinedBuffers.reduce(function(last, partBuffer){
9495
if(remainingBytesToRead <= 0) {
9596
return last;
@@ -101,8 +102,7 @@ let streamDecodeCombinedBuffer = (combinedBuffers, length, decodeFn, endFn) => {
101102
return last + decodeFn(lastSlice);
102103
}
103104
remainingBytesToRead -= partBuffer.length;
104-
let tmp = decodeFn(partBuffer);
105-
return last + tmp;
105+
return last + decodeFn(partBuffer);
106106
}, '');
107107
return out + endFn();
108108
}

test/browser/testrunner-phantomjs.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
45
<title>Jasmine Test Runner</title>
56

67
<link rel="shortcut icon" type="image/png" href="jasmine/lib/jasmine-2.0.3/jasmine_favicon.png">

test/internal/utf8.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('utf8', function() {
1616
expect( packAndUnpack( "åäö123" ) ).toBe( "åäö123" );
1717
});
1818

19-
it('should read/write utf8 from a complete combined buffer', function() {
19+
it('should decode utf8 from a complete combined buffer', function() {
2020
// Given
2121
var msg = "asåfqwer";
2222
var buf = utf8.encode(msg);
@@ -32,7 +32,7 @@ describe('utf8', function() {
3232
expect(decoded).toBe(msg);
3333
});
3434

35-
it('should read/write utf8 from part of a combined buffer', function() {
35+
it('should decode utf8 from part of a combined buffer', function() {
3636
// Given
3737
var msg = "asåfq";
3838
var expectMsg = msg.substring(0, msg.length-1);

0 commit comments

Comments
 (0)