]>
Commit | Line | Data |
---|---|---|
1 | var fs = require('fs'); | |
2 | ||
3 | var should = require('should'); | |
4 | ||
5 | require('../minify.json.js'); | |
6 | ||
7 | describe('JSON.minify', function() { | |
8 | it('define', function() { | |
9 | JSON.minify.should.be.ok; | |
10 | }); | |
11 | it('in-memory string', function() { | |
12 | var json = '{"key":"value"}'; | |
13 | var res = JSON.minify(json); | |
14 | JSON.parse(res).key.should.equal('value'); | |
15 | }); | |
16 | it('comment.json', function() { | |
17 | var json = fs.readFileSync(__dirname + '/comment.json', 'utf8'); | |
18 | var res = JSON.parse(JSON.minify(json)); | |
19 | res.foo.should.equal('bar'); | |
20 | }); | |
21 | it('comment.json', function() { | |
22 | var json = fs.readFileSync(__dirname + '/plain.json', 'utf8'); | |
23 | var res = JSON.parse(JSON.minify(json)); | |
24 | res.foo.should.equal('bar'); | |
25 | }); | |
26 | }); |