A web app that enables truckers to review a company that post loads. Reviewed By Trucker was created with Node, Express, HTML, and CSS.
Home View | Loads |
---|---|
Website: https://rbt-mc.herokuapp.com/
https://rbt-mc.herokuapp.com/
User can see a list of loads.
Index - https://rbt-mc.herokuapp.com/loads
Show - https://rbt-mc.herokuapp.com/loads/:id
Make sure you have Node.js >= 10.11.0 installed.
git clone https://github.com/campbellmarianna/Reviewed-By-Trucker.git
cd reviewed-by-trucker
npm i && nodemon
The app should now be running on localhost:3000.
Mocha, Chia, and Chai-Http need to be installed for running test.
npm install mocha chai chai-http
-
mocha
is our Test Runner - it actually runs our test code -
chai
is our Assertion Library - it gives us syntactic sugar to make writing test intuitive -
chai-http
is a Helper Test Library - it gives us methods to make http request inside our tests very easy
Make sure you have Mocha, Chia and Chia-Http installed.
Inside the project directory type mocha
to run the tests.
These tests check each route to make sure a HTML template is rendered.
// tell mocha we want to test Loads (this string is taco - it can be anything)
describe('Loads', () => {
// TEST HOME
// use taco name for the test
it('should display homepage on / GET', (done) => {
// use chai-http to make a request to our server
chai.request(server)
// send a GET request to root route
.get('/')
// wait for response
.end((err, res) => {
// check that the response status is == 200 (success)
res.should.have.status(200);
// check that the response is a type html
res.should.be.html;
// end this test and move onto the next
done();
});
});
...
})