Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fix: imports in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dara Hayes committed Jul 8, 2019
1 parent 44b9d04 commit 134a43a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions test/AuthContextProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import test from 'ava'

import { KeycloakAuthContextProvider } from '../src/AuthContextProvider'
import { KeycloakContextProvider } from '../src/KeycloakContextProvider'

test('AuthContextProvider accessToken is the access_token in req.kauth', (t) => {

Expand All @@ -19,7 +19,7 @@ test('AuthContextProvider accessToken is the access_token in req.kauth', (t) =>
}
}

const provider = new KeycloakAuthContextProvider({ req })
const provider = new KeycloakContextProvider({ req })
t.deepEqual(provider.accessToken, req.kauth.grant.access_token)
})

Expand All @@ -41,7 +41,7 @@ test('AuthContextProvider hasRole calls hasRole in the access_token', (t) => {
}
}

const provider = new KeycloakAuthContextProvider({ req })
const provider = new KeycloakContextProvider({ req })
t.truthy(provider.hasRole(''))
})

Expand All @@ -61,7 +61,7 @@ test('AuthContextProvider.isAuthenticated is true when token is defined and isEx
}
}

const provider = new KeycloakAuthContextProvider({ req })
const provider = new KeycloakContextProvider({ req })
t.truthy(provider.isAuthenticated())
})

Expand All @@ -81,7 +81,7 @@ test('AuthContextProvider.isAuthenticated is false when token is defined but isE
}
}

const provider = new KeycloakAuthContextProvider({ req })
const provider = new KeycloakContextProvider({ req })
t.false(provider.isAuthenticated())
})

Expand All @@ -101,6 +101,6 @@ test('AuthContextProvider.hasRole is false if token is expired', (t) => {
}
}

const provider = new KeycloakAuthContextProvider({ req })
const provider = new KeycloakContextProvider({ req })
t.false(provider.hasRole(''))
})
4 changes: 2 additions & 2 deletions test/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { GraphQLSchema } from 'graphql'
import { VisitableSchemaType } from 'graphql-tools/dist/schemaVisitor'
import { AuthDirective } from '../src/directives/schemaDirectiveVisitors'

import { KeycloakAuthContextProvider } from '../src/AuthContextProvider'
import { KeycloakContextProvider } from '../src/KeycloakContextProvider'

const createHasRoleDirective = () => {
return new AuthDirective({
Expand Down Expand Up @@ -45,7 +45,7 @@ test('happy path: context.auth.isAuthenticated() is called, then original resolv
}
const context = {
request: req,
auth: new KeycloakAuthContextProvider({ req })
auth: new KeycloakContextProvider({ req })
}

const isAuthenticatedSpy = sinon.spy(context.auth, 'isAuthenticated')
Expand Down
12 changes: 6 additions & 6 deletions test/hasRole.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { GraphQLSchema } from 'graphql'
import { VisitableSchemaType } from 'graphql-tools/dist/schemaVisitor'
import { HasRoleDirective } from '../src/directives/schemaDirectiveVisitors'

import { KeycloakAuthContextProvider } from '../src/AuthContextProvider'
import { KeycloakContextProvider } from '../src/KeycloakContextProvider'

const createHasRoleDirective = (directiveArgs: any) => {
return new HasRoleDirective({
Expand Down Expand Up @@ -53,7 +53,7 @@ test('context.auth.hasRole() is called', async (t) => {
}
const context = {
request: req,
auth: new KeycloakAuthContextProvider({ req })
auth: new KeycloakContextProvider({ req })
}

const info = {
Expand Down Expand Up @@ -102,7 +102,7 @@ test('visitFieldDefinition accepts an array of roles', async (t) => {
}
const context = {
request: req,
auth: new KeycloakAuthContextProvider({ req })
auth: new KeycloakContextProvider({ req })
}

const info = {
Expand Down Expand Up @@ -138,7 +138,7 @@ test('if there is no authentication, then an error is returned and the original
const req = {}
const context = {
request: req,
auth: new KeycloakAuthContextProvider({ req })
auth: new KeycloakContextProvider({ req })
}

const info = {
Expand Down Expand Up @@ -189,7 +189,7 @@ test('if token does not have the required role, then an error is returned and th
}
const context = {
request: req,
auth: new KeycloakAuthContextProvider({ req })
auth: new KeycloakContextProvider({ req })
}

const info = {
Expand Down Expand Up @@ -263,7 +263,7 @@ test('context.auth.hasRole() works even if request is not supplied in context',
}
}
const context = {
auth: new KeycloakAuthContextProvider({ req })
auth: new KeycloakContextProvider({ req })
}

const info = {
Expand Down

0 comments on commit 134a43a

Please sign in to comment.