Skip to content

Instantly share code, notes, and snippets.

@zac11
Last active October 20, 2018 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zac11/5c20f9ce7ca4b4189c5adecee43e7e98 to your computer and use it in GitHub Desktop.
Save zac11/5c20f9ce7ca4b4189c5adecee43e7e98 to your computer and use it in GitHub Desktop.
const supertest = require('supertest');
const expect = require('chai').expect;
const schema = require('../validation/list_users_schema');
const joi = require('joi');
let baseURL = supertest("https://reqres.in");
let list_users = "/api/users";
describe('POST Request',()=>{
let post_resp;
it('makes a POST call ',async ()=>{
post_resp = await baseURL.post(list_users)
.type('form')
.send({
"name": "morpheus",
"job": "leader"
})
.set('Accept','/application/\json/');
await (console.log(post_resp.body));
});
it('asserts that the response code is 201',async ()=>{
await (expect(post_resp.status).to.eql(201));
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment