forked from phts/nodejs-torrent-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracker.test.ts
More file actions
40 lines (33 loc) · 870 Bytes
/
Copy pathtracker.test.ts
File metadata and controls
40 lines (33 loc) · 870 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
36
37
38
39
40
'use strict';
var expect = require('chai').expect;
var http = require('http');
describe('Tracker', function () {
const PORT = 8787;
var Tracker = require('../app/tracker').Tracker,
tracker;
beforeEach(function () {
tracker = new Tracker();
tracker.start(PORT);
});
afterEach(function () {
tracker.close();
});
describe('GET /', function () {
var URL = `http://localhost:${PORT}`;
it('has status 404', function (done) {
http.get(URL, function (response) {
expect(response.statusCode).to.equal(404);
done();
});
});
});
describe('GET /announce', function () {
var URL = `http://localhost:${PORT}/announce`;
it('has status 200', function (done) {
http.get(URL, function (response) {
expect(response.statusCode).to.equal(200);
done();
});
});
});
});