Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesso committed Nov 10, 2018
1 parent 7f0fbc9 commit 676f8ad
Show file tree
Hide file tree
Showing 5 changed files with 243 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ after_script:
- npm run test

after_success:
- npm run coveralls
- npm run coverage


228 changes: 228 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "NODE_ENV=test nyc mocha --require @babel/register \"./server/**/*.spec.js*\" --exit && nyc report --reporter=text-lcov | coveralls",
"test": "NODE_ENV=test nyc --require @babel/register mocha \"./server/**/*.spec.js*\" --exit",
"dev": "webpack --mode development",
"build": "webpack --mode production",
"start:server": "babel-node server/app.js",
"start:client": "webpack-dev-server --mode development --open --hot",
"start:prod": "babel-node server/app.prod.js",
"start": "concurrently \"npm run start:client\" \"npm run start:server\"",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls"
"coveralls": "cat ./coverage/lcov.info | ./node_modules/.bin/coveralls",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"keywords": [],
"author": "",
Expand All @@ -22,6 +23,7 @@
"css-loader": "^1.0.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"istanbul": "^0.4.5",
"jscoverage": "^0.6.0",
"mini-css-extract-plugin": "^0.4.4",
"nyc": "^13.1.0",
Expand Down
2 changes: 1 addition & 1 deletion server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ app.set('view engine', 'ejs');

app.use(bodyParser.urlencoded({ extended: false }))
app.use('/api/v1/parcels', parcelRoute)
app.use('/api/v1/users',userRoute)
app.use('/api/v1/users', userRoute)

app.get('/', (req, res) => {
return res.status(200).json({ msg: 'Welcome to Send-It API'});
Expand Down
13 changes: 9 additions & 4 deletions server/test/users.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import app from '../app'

let should = chai.should();
chai.use(chaiHttp)
const request = chai.request(app)

// after(() => {
// request.server.close();
// })


describe('Parcel delivery orders', () => {
beforeEach((done) => {
afterEach((done) => {
done();
});

//after(() => request.server.close());

describe('/GET users', () => {
const request = chai.request(app)

it('it should GET all users', (done) => {
request
.get('/api/v1/users')
Expand All @@ -29,9 +32,11 @@ describe('Parcel delivery orders', () => {
});

describe('/GET/:id/parcels', () => {
const request = chai.request(app)

it('it should GET parcel delivery order with specific ID', (done) => {
let userId = 2;
const url = `/api/v1/users/:${userId}`
const url = `/api/v1/users/${userId}`
request
.get(url)
.end((err, res) => {
Expand Down

0 comments on commit 676f8ad

Please sign in to comment.