Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
running prettier on existing files.
Browse files Browse the repository at this point in the history
  • Loading branch information
mojitoj committed Nov 1, 2019
1 parent 4586332 commit b8fcc1e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 29 deletions.
8 changes: 4 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ const express = require("express");
const bodyParser = require("body-parser");
const morgan = require("morgan");

const {ping} = require("./controllers/ping");
const { ping } = require("./controllers/ping");

const app = express();

//middlewares
(process.env.NODE_ENV === "production") || app.use(morgan("dev"));
app.use(bodyParser.json({type: "application/json"}));
process.env.NODE_ENV === "production" || app.use(morgan("dev"));
app.use(bodyParser.json({ type: "application/json" }));

//routes
app.get("/ping", ping);

module.exports = {
app
app
};
8 changes: 4 additions & 4 deletions controllers/ping.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function ping (req, res) {
res.send("");
function ping(req, res) {
res.send("");
}

module.exports = {
ping
}
ping
};
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
globalSetup: "<rootDir>/setupTests.js",
modulePathIgnorePatterns: ["./tests/fixtures"],
collectCoverage: true
}
globalSetup: "<rootDir>/setupTests.js",
modulePathIgnorePatterns: ["./tests/fixtures"],
collectCoverage: true
};
12 changes: 6 additions & 6 deletions lib/logger.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const winston = require("winston");
const logger = winston.createLogger({
level: process.env.LOG_LEVEL || "debug",
transports: [new winston.transports.Console()],
format: winston.format.combine(
winston.format.colorize({all: true}),
winston.format.simple()
)
level: process.env.LOG_LEVEL || "debug",
transports: [new winston.transports.Console()],
format: winston.format.combine(
winston.format.colorize({ all: true }),
winston.format.simple()
)
});

module.exports = logger;
3 changes: 1 addition & 2 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

const dotenv = require("dotenv");
dotenv.config();

const {app} = require("./app");
const { app } = require("./app");

const logger = require("./lib/logger");

Expand Down
5 changes: 2 additions & 3 deletions setupTests.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require("dotenv").config({path: ".env.test"});
require("dotenv").config({ path: ".env.test" });
process.env.NODE_ENV = "test";

async function setUp() {
}
async function setUp() {}

module.exports = setUp;
11 changes: 5 additions & 6 deletions test/controllers/ping.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
const request = require("supertest");
const {app} = require("../../app");
const { app } = require("../../app");

it("should respond to ping", async () => {
expect.assertions(2);
expect.assertions(2);

const res = await request(app)
.get("/ping");
expect(res.status).toEqual(200);
expect(res.body).toMatchObject({});
const res = await request(app).get("/ping");
expect(res.status).toEqual(200);
expect(res.body).toMatchObject({});
});

0 comments on commit b8fcc1e

Please sign in to comment.