One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
| it("it shoud return status code 400 if we dosent send anything", function(done){ | |
| supertest(app) | |
| .post("/") | |
| .send({}) | |
| .expect(400) | |
| .end(function(err, res){ | |
| if (err) done(err); | |
| done(); | |
| }); | |
| }); |
| describe("POST /", function(){ | |
| it("it shoud return status code 200 is name exists", function(done) { | |
| supertest(app) | |
| .post("/") | |
| .send({ name: "Hope" }) | |
| .expect(200) | |
| .end(function(err, res){ | |
| if (err) done(err); | |
| done(); | |
| }); |
| app.post("/", (req, res) => { | |
| const { name } = req.body; | |
| if (!name || name === undefined) { | |
| res.statusCode(400); | |
| } | |
| res.json({ input: name }); | |
| }); |
| it("it shoud has response with hope key with value of loop", function(done){ | |
| supertest(app) | |
| .get("/") | |
| .expect({ hope: "loop" }) | |
| .end(function(err, res){ | |
| if (err) done(err); | |
| done(); | |
| }); | |
| }); |
| const supertest = require("supertest"); | |
| const assert = require('assert'); | |
| const app = require("../index"); | |
| describe("GET /", function() { | |
| it("it should has status code 200", function(done) { | |
| supertest(app) | |
| .get("/") | |
| .expect(200) | |
| .end(function(err, res){ |
| const supertest = require("supertest"); | |
| const assert = require('assert'); | |
| const app = require("../index"); |
| const express = require("express"); | |
| const bodyParser = require("body-parser"); | |
| const app = express(); | |
| app.use(bodyParser.json()); | |
| app.use(bodyParser.urlencoded({ extended: false })); | |
| app.get("/", (req, res) => { | |
| res.json({ hope: "loop" }); | |
| }); |
| git config --global http.proxy http://myproxyserver:8080 |
| //first | |
| cd ~ | |
| //then | |
| vim .bash_profile | |
| //and after that put this line and save and opne/close bash on ubuntu on windows |