-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.test.js
More file actions
51 lines (42 loc) · 1.15 KB
/
index.test.js
File metadata and controls
51 lines (42 loc) · 1.15 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var chai = require('chai');
var expect = chai.expect;
var should = chai.should();
var assert = require('assert');
var http = require('http');
var sinon = require('sinon');
var chai = require('chai');
var request = require('superagent');
var express = require('express');
var app = express();
var server = require('./server');
describe('the server', function () {
// this.timeout(5000);
it('should return 200', function (done) {
http.get('http://localhost:8000', function (res) {
assert.equal(200, res.statusCode);
done();
});
});
it('should make GET request to display button', function (done) {
http.get('http://localhost:8000', function (res) {
var data = '';
res.on('data', function (chunk) {
data += chunk;
});
res.on('end', function () {
data.should.not.be.empty
done();
});
});
});
it('should post data on button click', function (done) {
request.post('http://localhost:8000')
.send("world")
.end(function(err, res){
console.log('here!');
expect(res).to.exist;
// expect(res.statusCode).to.equal(200);
done();
})
});
});