Fix eslint

This commit is contained in:
Robert Schäfer 2019-01-02 16:01:25 +01:00
parent 0185f743e8
commit d98a05a476
3 changed files with 9 additions and 8 deletions

View File

@ -9,7 +9,7 @@ let app
let port let port
beforeEach(async () => { beforeEach(async () => {
const server = createServer({mocks}) const server = createServer({ mocks })
app = await server.start({ port: 0 }) app = await server.start({ port: 0 })
port = app.address().port port = app.address().port
getHost = () => `http://127.0.0.1:${port}` getHost = () => `http://127.0.0.1:${port}`
@ -45,7 +45,7 @@ describe.only('login', () => {
describe('asking for a `token`', () => { describe('asking for a `token`', () => {
describe('with valid email/password combination', () => { describe('with valid email/password combination', () => {
it('responds with a JWT token', async () => { it('responds with a JWT token', async () => {
const data = await request(getHost(), mutation({email: 'test@example.org', password: '1234'})) const data = await request(getHost(), mutation({ email: 'test@example.org', password: '1234' }))
const { token } = data.login const { token } = data.login
jwt.verify(token, process.env.JWT_SECRET, (err, data) => { jwt.verify(token, process.env.JWT_SECRET, (err, data) => {
expect(data.email).toEqual('test@example.org') expect(data.email).toEqual('test@example.org')
@ -57,7 +57,7 @@ describe.only('login', () => {
describe('with a valid email but incorrect password', () => { describe('with a valid email but incorrect password', () => {
it('responds with "Incorrect email address or password."', async () => { it('responds with "Incorrect email address or password."', async () => {
try { try {
await request(getHost(), mutation({email: 'test@example.org', password: 'wrong'})) await request(getHost(), mutation({ email: 'test@example.org', password: 'wrong' }))
} catch (error) { } catch (error) {
expect(error.response.errors[0].message).toEqual('Incorrect email address or password.') expect(error.response.errors[0].message).toEqual('Incorrect email address or password.')
} }
@ -67,7 +67,7 @@ describe.only('login', () => {
describe('with a non-existing email', () => { describe('with a non-existing email', () => {
it('responds with "Incorrect email address or password."', async () => { it('responds with "Incorrect email address or password."', async () => {
try { try {
await request(getHost(), mutation({email: 'non-existent@example.org', password: 'wrong'})) await request(getHost(), mutation({ email: 'non-existent@example.org', password: 'wrong' }))
} catch (error) { } catch (error) {
expect(error.response.errors[0].message).toEqual('Incorrect email address or password.') expect(error.response.errors[0].message).toEqual('Incorrect email address or password.')
} }

View File

@ -5,6 +5,7 @@ import { HttpLink } from 'apollo-link-http'
import { InMemoryCache } from 'apollo-cache-inmemory' import { InMemoryCache } from 'apollo-cache-inmemory'
import neo4j from '../../bootstrap/neo4j' import neo4j from '../../bootstrap/neo4j'
import { query } from '../../graphql-schema' import { query } from '../../graphql-schema'
import fetch from 'node-fetch'
dotenv.config() dotenv.config()
@ -21,7 +22,7 @@ const driver = neo4j().getDriver()
const session = driver.session() const session = driver.session()
const builders = { const builders = {
"user": require('./users.js').default, 'user': require('./users.js').default
} }
const buildMutation = (model, parameters) => { const buildMutation = (model, parameters) => {
@ -29,7 +30,7 @@ const buildMutation = (model, parameters) => {
} }
const create = async (model, parameters) => { const create = async (model, parameters) => {
await client.mutate({mutation: gql(buildMutation(model, parameters))}) await client.mutate({ mutation: gql(buildMutation(model, parameters)) })
} }
const cleanDatabase = async () => { const cleanDatabase = async () => {

View File

@ -1,10 +1,10 @@
import faker from 'faker' import faker from 'faker'
export default function (params){ export default function (params) {
const { const {
name = faker.name.findName(), name = faker.name.findName(),
email = faker.internet.email(), email = faker.internet.email(),
password = '1234', password = '1234',
avatar = faker.internet.avatar() avatar = faker.internet.avatar()
} = params } = params