Small refactoring let client in the upmost scope

cc @Tirokk
This commit is contained in:
Robert Schäfer 2019-03-13 13:57:46 +01:00
parent 3d56875be5
commit ac155b7f17

View File

@ -3,6 +3,7 @@ import { GraphQLClient } from 'graphql-request'
import { host, login } from '../jest/helpers'
const factory = Factory()
let client
describe('badges', () => {
beforeEach(async () => {
@ -55,7 +56,6 @@ describe('badges', () => {
`
describe('unauthenticated', () => {
let client
it('throws authorization error', async () => {
client = new GraphQLClient(host)
@ -66,7 +66,6 @@ describe('badges', () => {
})
describe('authenticated admin', () => {
let client
beforeEach(async () => {
const headers = await login({ email: 'admin@example.org', password: '1234' })
client = new GraphQLClient(host, { headers })
@ -86,7 +85,6 @@ describe('badges', () => {
})
describe('authenticated moderator', () => {
let client
beforeEach(async () => {
const headers = await login({ email: 'moderator@example.org', password: '1234' })
client = new GraphQLClient(host, { headers })
@ -120,7 +118,6 @@ describe('badges', () => {
`
describe('unauthenticated', () => {
let client
it('throws authorization error', async () => {
client = new GraphQLClient(host)
@ -131,7 +128,6 @@ describe('badges', () => {
})
describe('authenticated moderator', () => {
let client
beforeEach(async () => {
const headers = await login({ email: 'moderator@example.org', password: '1234' })
client = new GraphQLClient(host, { headers })
@ -145,7 +141,6 @@ describe('badges', () => {
})
describe('authenticated admin', () => {
let client
beforeEach(async () => {
const headers = await login({ email: 'admin@example.org', password: '1234' })
client = new GraphQLClient(host, { headers })
@ -180,7 +175,6 @@ describe('badges', () => {
`
describe('unauthenticated', () => {
let client
it('throws authorization error', async () => {
client = new GraphQLClient(host)
@ -191,7 +185,6 @@ describe('badges', () => {
})
describe('authenticated moderator', () => {
let client
beforeEach(async () => {
const headers = await login({ email: 'moderator@example.org', password: '1234' })
client = new GraphQLClient(host, { headers })
@ -205,7 +198,6 @@ describe('badges', () => {
})
describe('authenticated admin', () => {
let client
beforeEach(async () => {
const headers = await login({ email: 'admin@example.org', password: '1234' })
client = new GraphQLClient(host, { headers })