-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
3 changed files
with
15 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,4 @@ | ||
import { factory } from 'factory-girl'; | ||
import { jwt } from '@ctt/service-utils'; | ||
import server, { Map } from '../../src/server'; | ||
import config, { configFiles } from '../../src/utils/loadconfig'; | ||
import server from '../../src/server'; | ||
import { Server } from 'hapi'; | ||
|
||
config.loadFile(configFiles); | ||
|
||
export default async (): Promise<Server> => await server(); | ||
|
||
export const bearerToken = async (): Promise<Map<string>> => { | ||
const user = { | ||
fullname: 'test Test', | ||
email: 'bolatan.ibrahim${n}@craftturf.com', | ||
role: '5eb01d542a78e8e74c3ff56c', | ||
} | ||
const { email, fullname, role } = user; | ||
const token = jwt.generateToken( | ||
{ | ||
fullname, | ||
role, | ||
email, | ||
}, | ||
config, | ||
); | ||
|
||
return { authorization: token }; | ||
}; | ||
|
||
export const parsedSingleResponse = ({ payload }): object | any => JSON.parse(payload)['data'][0]; | ||
|
||
export const parsedResponse = ({ payload }): object | any => JSON.parse(payload); | ||
|
||
export const parsedArrayResponse = ({ payload }): object | any => JSON.parse(payload)['data']; | ||
|
||
export const parsedErrorResponse = ({ payload }): object | any => JSON.parse(payload)['error']; |