Setting up jest to run

master
Jacob Windle 2019-01-24 22:13:48 -05:00
parent 33c6c41e8d
commit 95e8d830a0
3 changed files with 11 additions and 3 deletions

View File

@ -2,7 +2,7 @@ var net = require('net');
var http = require('http');
class HttpRequest {
constructor({...attrs}) {
constructor({attrs}) {
this.type = attrs.type;
this.headers = attrs.headers;
this.body = attrs.body;
@ -31,6 +31,7 @@ function parseHttpRequest(bytes) {
httpRequestAttrs["type"] = typeInfo[0];
httpRequestAttrs["path"] = typeInfo[1];
httpRequestAttrs["httpVersion"] = typeInfo[2];
} else {
console.log(row);
}
@ -64,4 +65,6 @@ server.on("listening", (c) => {
server.listen(8124, () => {
console.log("Server bound.");
})
})
module.exports = [parseHttpRequest];

5
index.test.js Normal file
View File

@ -0,0 +1,5 @@
const index = require('./index.js');
test('parses first line', () => {
expect(true).toBe(true);
})

View File

@ -4,7 +4,7 @@
"description": "A proxy built using NodeJS",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "jest",
"run": "node index.js"
},
"author": "jaketothepast",