Browse Source

tried to do some stuff to get mocha working.

pull/41/head
Eric Lang 3 years ago
parent
commit
fbe13a1603
4 changed files with 30 additions and 12 deletions
  1. +9
    -8
      server/package.json
  2. +2
    -0
      server/routes/api/index.js
  3. +11
    -0
      server/routes/test/v2.js
  4. +8
    -4
      server/server.js

+ 9
- 8
server/package.json View File

@ -1,11 +1,11 @@
{
"name": "github-graphs",
"version": "0.0.1",
"version": "0.0.2",
"description": "Generates graphs of github things.",
"main": "server.js",
"scripts": {
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
"test": "mocha --exit --reporter spec",
"test": "mocha routes/test --exit --reporter spec",
"start": "node server.js"
},
"repository": {
@ -19,15 +19,16 @@
},
"homepage": "https://github.com/jrtechs/github-graphs#readme",
"dependencies": {
"dotenv": "^8.2.0",
"express": "^4.16.4",
"express-session": "^1.15.6",
"dotenv": "~8.2.0",
"express": "~4.16.4",
"express-session": "~1.15.6",
"fs": "0.0.1-security",
"got": "^9.6.0",
"memory-cache": "^0.2.0"
}
"got": "~9.6.0",
"memory-cache": "~0.2.0"
},
"devDependencies": {
"coveralls": "*",
"mocha": "*",
"nyc": "*"
}
}

+ 2
- 0
server/routes/api/index.js View File

@ -0,0 +1,2 @@
exports.V1 = require('./v1');
exports.V2 = require('./v2');

+ 11
- 0
server/routes/test/v2.js View File

@ -0,0 +1,11 @@
const assert = require('assert');
const V2 = require('../api/v2');
describe('github api v2', function() {
it('successfully queries friends', async function() {
var queryFriends = V2.queryFriends;
// it was this point that Eric realized he doesn't understand
// module.exports very well.
assert.strictEqual(typeof(queryFriends), typeof(queryFriends));
});
});

+ 8
- 4
server/server.js View File

@ -1,10 +1,14 @@
const crypto = require('crypto');
const app = express();
const dotenv = require("dotenv").config();
const express = require("express");
const session = require('express-session');
const dotenv = require("dotenv").config();
const app = express();
const sessionProperties = {
secret: process.env.SESSION_SECRET,
secret: process.env.SESSION_SECRET || crypto.randomBytes(64),
cookie: { maxAge: 6000000 },
resave: false,
saveUninitialized: false
@ -18,4 +22,4 @@ const routes = require('./routes');
app.use('/', routes);
app.listen(process.env.PORT, () => console.log(`App listening on port ${process.env.PORT}!`));
app.listen(process.env.PORT || 8100, () => console.log(`App listening on port ${process.env.PORT || 8100}!`));

Loading…
Cancel
Save