Skip to content

Instantly share code, notes, and snippets.

View tolulope-od's full-sized avatar
🎯
Focusing

Tolulope Odueke tolulope-od

🎯
Focusing
View GitHub Profile
@tolulope-od
tolulope-od / index.js
Created June 9, 2019 10:34
Entry point for Node/Express app for testing
import express from 'express';
const port = process.env.PORT || 4000;
const app = express();
// This is where the magic happens.
// We write the case needed for our test to pass
app.get('/', (req, res) => {
res.status(200).json({
message: 'Hello Books'
@tolulope-od
tolulope-od / rootRoute.spec.js
Last active June 9, 2019 21:25
Testing a NodeJS API server root URL
// Import the testing dependencies
import chai from 'chai';
import chaiHttp from 'chai-http';
import app from '../../';
describe('App Root', () => {
it('should return status 200 and a message attribute', (done) => {
chai.request(app)
.get('/')
.end((err, res) => {