Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Burak Tasci
committed
Dec 24, 2018
1 parent
e601431
commit d8fa0d1
Showing
29 changed files
with
628 additions
and
893 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
// module | ||
import { Auth0Backend } from './auth0-backend'; | ||
|
||
export interface Auth0Settings { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
let order = 0; | ||
|
||
export class WebAuth { | ||
constructor(...args) {/**/} | ||
|
||
authorize(): void {/**/} | ||
authorize(): void { | ||
/**/ | ||
} | ||
|
||
parseHash(callback: Function): void { | ||
order++; | ||
|
||
return callback(undefined, order !== 1 | ||
? {} | ||
: { | ||
accessToken: 'test', | ||
idToken: 'test', | ||
expiresIn: 7200 | ||
}); | ||
return callback( | ||
undefined, | ||
order !== 1 | ||
? {} | ||
: { | ||
accessToken: 'test', | ||
idToken: 'test', | ||
expiresIn: 7200 | ||
} | ||
); | ||
} | ||
} |
91 changes: 35 additions & 56 deletions
91
packages/@ngx-auth/auth0/tests/auth0-server.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,52 @@ | ||
// angular | ||
import { async, inject } from '@angular/core/testing'; | ||
|
||
// module | ||
import { Auth0Service } from '../index'; | ||
import { Auth0ServerService } from '../src/auth0-server.service'; | ||
|
||
import { testServerModuleConfig } from './common'; | ||
|
||
describe('@ngx-auth/auth0:', | ||
() => { | ||
beforeEach(testServerModuleConfig); | ||
describe('@ngx-auth/auth0:', () => { | ||
beforeEach(testServerModuleConfig); | ||
|
||
describe('Auth0ServerService', | ||
() => { | ||
beforeEach(inject([Auth0Service], | ||
(auth: Auth0Service) => { | ||
auth.invalidate(); | ||
})); | ||
describe('Auth0ServerService', () => { | ||
beforeEach(inject([Auth0Service], async (auth: Auth0Service) => auth.invalidate())); | ||
|
||
it('is defined', | ||
inject([Auth0Service], | ||
(auth: Auth0Service) => { | ||
auth.authorize(); | ||
it('is defined', inject([Auth0Service], (auth: Auth0Service) => { | ||
auth.authorize(); | ||
|
||
expect(Auth0Service) | ||
.toBeDefined(); | ||
expect(auth) | ||
.toBeDefined(); | ||
expect(auth instanceof Auth0ServerService) | ||
.toBeTruthy(); | ||
})); | ||
expect(Auth0Service).toBeDefined(); | ||
expect(auth).toBeDefined(); | ||
expect(auth instanceof Auth0ServerService).toBeTruthy(); | ||
})); | ||
|
||
it('should be able to return an undefined `defaultUrl`', | ||
inject([Auth0Service], | ||
(auth: Auth0Service) => { | ||
const res = auth.defaultUrl; | ||
expect(res) | ||
.toBeUndefined(); | ||
})); | ||
it('should be able to return an undefined `defaultUrl`', inject([Auth0Service], (auth: Auth0Service) => { | ||
const res = auth.defaultUrl; | ||
expect(res).toBeUndefined(); | ||
})); | ||
|
||
it('should not authenticate', | ||
async(inject([Auth0Service], | ||
(auth: Auth0Service) => { | ||
auth.authenticate() | ||
.subscribe(res => { | ||
expect(res) | ||
.toEqual(false); | ||
it('should not authenticate', async( | ||
inject([Auth0Service], (auth: Auth0Service) => { | ||
auth.authenticate().subscribe(res => { | ||
expect(res).toEqual(false); | ||
|
||
const accessToken = auth.accessToken; | ||
expect(accessToken) | ||
.toBeUndefined(); | ||
const accessToken = auth.accessToken; | ||
expect(accessToken).toBeUndefined(); | ||
|
||
const idToken = auth.idToken; | ||
expect(idToken) | ||
.toBeUndefined(); | ||
const idToken = auth.idToken; | ||
expect(idToken).toBeUndefined(); | ||
|
||
const expiresAt = auth.expiresAt; | ||
expect(expiresAt) | ||
.toBeUndefined(); | ||
const expiresAt = auth.expiresAt; | ||
expect(expiresAt).toBeUndefined(); | ||
|
||
const isAuthenticated = auth.isAuthenticated; | ||
expect(isAuthenticated) | ||
.toEqual(false); | ||
const isAuthenticated = auth.isAuthenticated; | ||
expect(isAuthenticated).toEqual(false); | ||
|
||
const isAuthenticated$ = auth.isAuthenticated$; | ||
isAuthenticated$.subscribe(isAuth => { | ||
expect(isAuth) | ||
.toEqual(false); | ||
}); | ||
}); | ||
}))); | ||
}); | ||
const isAuthenticated$ = auth.isAuthenticated$; | ||
isAuthenticated$.subscribe(isAuth => { | ||
expect(isAuth).toEqual(false); | ||
}); | ||
}); | ||
}) | ||
)); | ||
}); | ||
}); |
Oops, something went wrong.