Skip to content

Commit

Permalink
fixing paths and missing modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmr89 committed Jun 23, 2015
1 parent 873ef9c commit 6568e11
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 61 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ let os = require('os');
let randomBytes = require('crypto').randomBytes;
let co = require('co');
let compose = require('koa-compose');
let SSLGenerator = require('../ssl-generator');
let debug = require('debug')('../proxy:http');
let context = require('../lib/context');
let SSLGenerator = require('ssl-generator');
let debug = require('debug')('proxy:http');
let context = require('./lib/context');

let app = ProxyHTTP.prototype;

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
"dependencies": {
"co": "^4.5.4",
"koa-compose": "^2.3.0",
"lodash.defaults": "^3.1.1",
"native-dns": "^0.7.0"
"debug": "^2.2.0",
"ssl-generator": "0.0.1",
"statuses": "^1.2.1"
},
"devDependencies": {
"istanbul-harmony": "^0.3.15",
Expand Down
54 changes: 0 additions & 54 deletions test/index.js

This file was deleted.

48 changes: 46 additions & 2 deletions test/unittest.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,55 @@
var app = require('../index.js');
'use strict';
let fs = require('fs');
let ProxyHTTP = require('../');
var Store = function MemoryStore() {
var cache = {};
this.get = function (domain, fn) {
fn(null, cache[domain] || null);
};
this.set = function (certKeyData, fn) {
cache[certKeyData.domain] = {
cert: certKeyData.cert,
key: certKeyData.key
};
fn();
};
};
let sslConfig = {
ca: {
cert: fs.readFileSync('./test/ca.crt.pem'),
key: fs.readFileSync('./test/ca.key.pem')
},
csr: {
country: 'US',
state: 'Texas',
locality: 'Longview',
organization: 'Northshore Network Solutions',
organizationUnit: '',
emailAddress: 'support@northshore.io'
},
ttl: 10000,
store: new Store(),
};
let server = ProxyHTTP({
ssl: sslConfig
});
server.use(function *(next) {
console.log(this.req.url);
yield *next;
console.log('done')
});
// server.sslGenerator.selfSigned('google.com', function (err, certKey) {
// console.log(err, certKey);
// });
server.listen(3128, 3129);

var expect = require('expect.js');

// Begin Unit Tests
describe("Sample Test", function () {
describe("I don't know", function () {
it('should return blah', function (done) {
console.log(app);
console.log(server);
done();
});
});
Expand Down

0 comments on commit 6568e11

Please sign in to comment.