Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- it('it serves json on port 8001', function() {
- var ledger = new Ledger();
- ledger.service();
- ledger.append([{name:'A Thing', value: "A Value"},{horse:'pony',value:'cake'}],function(err,items){
- http = require('http');
- var google = http.createClient(8001, 'localhost');
- var request = google.request('GET', '/',{'host': 'localhost'});
- request.addListener('response', function (response) {
- response.setEncoding('utf8');
- expect(response.statusCode).toEqual(200);
- expect(response.headers["content-type"]).toEqual('text/json');
- response.addListener('data', function (chunk) {
- data = JSON.parse(chunk);
- expect(data[0]['name']).toEqual('A Thing');
- expect(data[1]['horse']).toEqual('pony');
- asyncSpecDone();
- });
- });
- request.end();
- });
- asyncSpecWait();
- });
Add Comment
Please, Sign In to add comment