-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
35 lines (29 loc) · 832 Bytes
/
test.js
File metadata and controls
35 lines (29 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
'use strict';
var vm = require('vm');
var expect = require('expect.js');
var objectStringify = require('./index');
var obj = {
'fooString': 'bar bar',
'fooInt': 1,
'fooDate': new Date('2015-04-28T00:00:00.000Z'),
'fooDate2': new Date(),
'fooArray': [1, 2, 3, 'foo', 'bar'],
'fooObject' : {
'foo': 'bar'
},
'fooFunction': function(){
var foo = 'bar bar';
return 'foo';
}
};
describe('Object-stringify testing', function(){
it('Should return a string', function(){
var s = objectStringify(obj, {beautify:true, indent_size:4});
expect(s).to.be.a('string');
});
it('Should return an object', function(){
var s = objectStringify(obj);
var b = vm.runInThisContext('b = '+s+';');
expect(b).to.be.a('object');
});
});