Setting up jest to run
This commit is contained in:
parent
33c6c41e8d
commit
95e8d830a0
5
index.js
5
index.js
@ -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);
|
||||
}
|
||||
@ -65,3 +66,5 @@ server.on("listening", (c) => {
|
||||
server.listen(8124, () => {
|
||||
console.log("Server bound.");
|
||||
})
|
||||
|
||||
module.exports = [parseHttpRequest];
|
5
index.test.js
Normal file
5
index.test.js
Normal file
@ -0,0 +1,5 @@
|
||||
const index = require('./index.js');
|
||||
|
||||
test('parses first line', () => {
|
||||
expect(true).toBe(true);
|
||||
})
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user