Archived
1
0
Fork 0
This repository has been archived on 2019-02-05. You can view files and clone it, but cannot push or open issues or pull requests.
Pong/node_modules/parsejson/test.js

22 lines
717 B
JavaScript
Raw Permalink Normal View History

2017-01-20 22:42:49 +00:00
var assert = require('better-assert');
var expect = require('expect.js');
var parsejson = require('./index.js');
describe('my suite', function(){
it('should parse a JSON string', function () {
var jsonString = '{"users" :[{"first_name":"foo", "last_name":"bar"}],' +
'"id" :40,' +
'"cities":["los angeles", "new york", "boston"]}';
var jsonObj = parsejson(jsonString);
expect(jsonObj.users[0].first_name).to.be("foo");
expect(jsonObj.users[0].last_name).to.be("bar");
expect(jsonObj.id).to.be(40);
expect(jsonObj.cities[0]).to.be('los angeles');
expect(jsonObj.cities[1]).to.be('new york');
expect(jsonObj.cities[2]).to.be('boston');
});
});