remove supertest

This commit is contained in:
kachulio1 2018-12-20 22:44:52 +03:00
parent 2ccbb1ca92
commit e58e228f0c
3 changed files with 37 additions and 22 deletions

View File

@ -72,6 +72,7 @@
"eslint-plugin-node": "~8.0.0",
"eslint-plugin-promise": "~4.0.1",
"eslint-plugin-standard": "~4.0.0",
"graphql-request": "^1.8.2",
"jest": "^23.6.0",
"nodemon": "~1.18.9",
"nyc": "^13.1.0",

View File

@ -1,28 +1,42 @@
import request from "supertest"
import server from './server'
import { request } from "graphql-request";
import server from "./server";
describe("login", () => {
describe("asking for a `token`", () => {
describe("with valid email/password combination", () => {
xit("responds with a JWT token", () => {});
});
describe('login', () => {
describe('asking for a `token`', () => {
describe('with valid email/password combination', () => {
xit('responds with a JWT token', () => {})
})
describe('with a valid email but incorrect password', () => {
describe("with a valid email but incorrect password", () => {
beforeEach(() => {
// create a user in the database
})
xit('responds with "Wrong email/password combination"', () => {})
})
});
xit('responds with "Wrong email/password combination"', () => {});
});
describe('with a non-existing email', () => {
describe("with a non-existing email", () => {
let getHost;
beforeEach(async () => {
const app = await server.start({ port: 0 });
const { port } = app.address();
getHost = () => `http://127.0.0.1:${port}`;
});
const email = "tom@bob.com";
const password = "jalksdf";
const mutation = `
mutation {
login(email:"asfasf@baldf.cm", password:"asdfasd"){
token
}
}`;
it('responds with "Wrong email/password combination"', async () => {
const app = (await server).createHttpServer({});
request(app).post('/graphql').send({}).expect(400)
})
})
})
})
const response = await request(getHost(), mutation);
expect(response).toBe({});
});
});
});
});

View File

@ -3506,7 +3506,7 @@ graphql-playground-middleware-lambda@1.7.6:
dependencies:
graphql-playground-html "1.6.4"
graphql-request@^1.5.0:
graphql-request@^1.5.0, graphql-request@^1.8.2:
version "1.8.2"
resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-1.8.2.tgz#398d10ae15c585676741bde3fc01d5ca948f8fbe"
integrity sha512-dDX2M+VMsxXFCmUX0Vo0TopIZIX4ggzOtiCsThgtrKR4niiaagsGTDIHj3fsOMFETpa064vzovI+4YV4QnMbcg==