Skip to content

Commit

Permalink
test: fix the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jannyHou committed May 27, 2019
1 parent 64c8e17 commit afb2f25
Show file tree
Hide file tree
Showing 21 changed files with 680 additions and 136 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {Request} from '@loopback/rest';
import {AuthenticateOptions, Strategy} from 'passport';
import {UserProfile} from '@loopback/authentication';
/**
* Test fixture for a mock asynchronous passport-strategy
*/
export declare class MockPassportStrategy extends Strategy {
private mockUser;
setMockUser(userObj: UserProfile): void;
/**
* authenticate() function similar to passport-strategy packages
* @param req
*/
authenticate(req: Request, options?: AuthenticateOptions): Promise<void>;
/**
* @param req
* mock verification function; usually passed in as constructor argument for
* passport-strategy
*
* For the purpose of mock tests we have this here
* pass req.query.testState = 'fail' to mock failed authorization
* pass req.query.testState = 'error' to mock unexpected error
*/
verify(request: Request): Promise<void>;
returnMockUser(): void;
returnUnauthorized(challenge?: string | number, status?: number): void;
returnError(err: string): void;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Loading

0 comments on commit afb2f25

Please sign in to comment.