-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const clientError = (req, res) => { | ||
res.status(404) | ||
.render('clientError'); | ||
}; | ||
|
||
|
||
const serverError = (err, req, res, next) => { | ||
res.status(500) | ||
.render('serverError'); | ||
}; | ||
|
||
|
||
module.exports = { | ||
clientError, | ||
serverError, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
const router = require('express').Router(); | ||
|
||
const {homeData, postData} = require('./homeData'); | ||
const { homeData, postData } = require('./homeData'); | ||
const { clientError, serverError } = require('./err'); | ||
|
||
router.get('/', homeData); | ||
router.post('/postPlace', postData); | ||
|
||
router.use(clientError); | ||
router.use(serverError); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>Client Error</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@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7KPT87Mk4d0BONeq0SKPf3PUyxEy5b8t1rwj4gkKxUW1Gh6mtpzPDc1ZMuRmU5vKp1XoKAmilNQJ1b7H+gE6qV+J4LHk3dFY0QCQCQD1o9pXTzxm5YnPG3xWHxfGniXTDjLKt29ijtvt6gbGxtbL1m6dONKAoAUAPyA+sj4XgFRiwLMSAts2qgOw9P/AkPEZSWsdjSe792+ii/5ysrMtTHxGSWc3yp8WSgOZmLBXGoGr8l2VoDpbbG7rrNxGsA+swuFTx3AH+Djrc/vnr99WxJ9K/iM3pnU9J6mHuxhzoeKym9KkqQFLFSDQLVuNW5HqImwFFk1uep9YmXLH2/lusvd9iInNZERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERA+Gcxk4dl0qmvWy6HQksLJ8z2einckg9gOs6iJeGfajLHuQcFwwxoEHbv6nufvJ4iTbvlc4IiJg/9k=" alt="" class="src"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
const { test1 } = require('./functions.test'); | ||
require('./routes.test'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const test = require('tape'); | ||
const supertest = require('supertest'); | ||
const app = require('./../src/app'); | ||
|
||
test('Status Code equal 200', (t) => { | ||
supertest(app) | ||
.get('/') | ||
.expect(200) | ||
.expect('content-type', /html/) | ||
.end((err, res) => { | ||
t.error(err); | ||
t.equal(res.text.includes('<h1> Hi Team</h1>'), true, 'The page should have a heading tag'); | ||
t.end(); | ||
}); | ||
}); | ||
|
||
|
||
test('post', (t) => { | ||
supertest(app) | ||
.post('/postPlace') | ||
.send({ | ||
userName: 'yosef', | ||
email: '[email protected]', | ||
phone: '45646', | ||
placeName: 'take', | ||
location: 'gaza', | ||
service: 'food', | ||
delivery: false, | ||
img: 'https://www.google.com' | ||
}) | ||
.expect(201) | ||
.expect('content-type', /html/) | ||
.end((err, res) => { | ||
// t.error(err); | ||
console.log(res.body); | ||
t.end(); | ||
}); | ||
}); |