Skip to content

Commit 1b4717c

Browse files
committed
Fix tests
1 parent c3c4c3a commit 1b4717c

File tree

1 file changed

+41
-47
lines changed

1 file changed

+41
-47
lines changed

test/index.js

Lines changed: 41 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
'use strict'
2-
var FIXTURES, JSON, fs, parseJson, path, should
32

4-
fs = require('fs')
3+
var parseJson = require('parse-json')
4+
var should = require('should')
5+
var path = require('path')
6+
var jsonFuture = require('..')
7+
var fs = require('fs')
58

6-
JSON = require('..')
7-
8-
should = require('should')
9-
10-
parseJson = require('parse-json')
11-
12-
path = require('path')
13-
14-
FIXTURES = {
9+
var FIXTURES = {
1510
string: '{\n "foo": "bar"\n}\n',
1611
object: {
1712
foo: 'bar'
@@ -24,71 +19,70 @@ describe('JSON Future ::', function () {
2419
after(function (done) {
2520
return fs.unlink(FIXTURES.path2, done)
2621
})
22+
2723
describe('sync', function () {
2824
it('.parse', function () {
29-
var json
30-
json = JSON.parse(FIXTURES.string)
31-
return json.foo.should.be.equal(FIXTURES.object.foo)
25+
var json = jsonFuture.parse(FIXTURES.string)
26+
json.foo.should.be.equal(FIXTURES.object.foo)
3227
})
28+
3329
it('.stringify', function () {
34-
var string
35-
string = JSON.stringify(FIXTURES.object)
36-
return string.should.be.equal(FIXTURES.string)
30+
var string = jsonFuture.stringify(FIXTURES.object)
31+
string.should.be.equal(FIXTURES.string)
3732
})
33+
3834
it('.load', function () {
39-
var json
40-
json = JSON.load(FIXTURES.path)
41-
return json.foo.should.be.equal(FIXTURES.object.foo)
35+
var json = jsonFuture.load(FIXTURES.path)
36+
json.foo.should.be.equal(FIXTURES.object.foo)
4237
})
43-
return it('.save', function () {
44-
var json
45-
JSON.save(FIXTURES.path2, {
46-
hello: 'world'
47-
})
48-
json = JSON.load(FIXTURES.path2)
49-
return json.hello.should.be.equal('world')
38+
39+
it('.save', function () {
40+
jsonFuture.save(FIXTURES.path2, {hello: 'world'})
41+
var json = jsonFuture.load(FIXTURES.path2)
42+
json.hello.should.be.equal('world')
5043
})
5144
})
52-
return describe('async', function () {
45+
46+
describe('async', function () {
5347
describe('.parseAsync', function () {
5448
it('String', function (done) {
55-
return JSON.parseAsync(FIXTURES.string, function (err, data) {
49+
jsonFuture.parseAsync(FIXTURES.string, function (err, data) {
5650
data.foo.should.be.equal(FIXTURES.object.foo)
57-
return done(err)
51+
done(err)
5852
})
5953
})
60-
return it('Buffer', function (done) {
61-
var buff
62-
buff = new Buffer(FIXTURES.string)
63-
return JSON.parseAsync(buff, function (err, data) {
54+
55+
it('Buffer', function (done) {
56+
var buff = new Buffer(FIXTURES.string)
57+
jsonFuture.parseAsync(buff, function (err, data) {
6458
data.foo.should.be.equal(FIXTURES.object.foo)
65-
return done(err)
59+
done(err)
6660
})
6761
})
6862
})
63+
6964
it('.stringifyAsync', function (done) {
70-
return JSON.stringifyAsync(FIXTURES.object, function (err, string) {
65+
jsonFuture.stringifyAsync(FIXTURES.object, function (err, string) {
7166
string.should.be.equal(FIXTURES.string)
72-
return done(err)
67+
done(err)
7368
})
7469
})
70+
7571
it('.loadAsync', function (done) {
76-
return JSON.loadAsync(FIXTURES.path, function (err, json) {
72+
jsonFuture.loadAsync(FIXTURES.path, function (err, json) {
7773
json.foo.should.be.equal(FIXTURES.object.foo)
78-
return done(err)
74+
done(err)
7975
})
8076
})
81-
return it('saveAsync', function (done) {
82-
return JSON.saveAsync(FIXTURES.path2, {
77+
78+
it('saveAsync', function (done) {
79+
jsonFuture.saveAsync(FIXTURES.path2, {
8380
hello: 'world2'
8481
}, function (err) {
85-
var json
86-
if (err) {
87-
return done(err)
88-
}
89-
return json = JSON.loadAsync(FIXTURES.path2, function (err, json) {
82+
if (err) return done(err)
83+
jsonFuture.loadAsync(FIXTURES.path2, function (err, json) {
9084
json.hello.should.be.equal('world2')
91-
return done(err)
85+
done(err)
9286
})
9387
})
9488
})

0 commit comments

Comments
 (0)