import nock = require('nock'); import { fixtures } from './fixtures/fixtures'; /** * Mock Http Responses. */ const mockRequests = () => { nock('https://api.bamboohr.com') .get('/api/gateway.php/firstfactory/v1/employees/directory') .reply(200, fixtures.directory); nock('https://api.bamboohr.com') .get('/api/gateway.php/firstfactory/v1/employees/all/tables/customProjectTracking') .reply(200, fixtures.projectTracking.all); nock('https://api.bamboohr.com') .get('/api/gateway.php/firstfactory/v1/employees/10') .query(true) .reply(200, fixtures.employees["10"]); nock('https://api.bamboohr.com') .get('/api/gateway.php/firstfactory/v1/employees/22') .query(true) .reply(200, fixtures.employees["22"]); nock('https://api.bamboohr.com') .get('/api/gateway.php/firstfactory/v1/employees/44') .query(true) .reply(200, fixtures.employees["44"]); nock('https://api.bamboohr.com') .get('/api/gateway.php/firstfactory/v1/employees/44/tables/customProjectTracking') .reply(200, fixtures.projectTracking["44"]); nock('https://api.bamboohr.com') .get('/api/gateway.php/firstfactory/v1/employees/60') .query(true) .reply(200, fixtures.employees["60"]); nock('https://api.bamboohr.com') .get('/api/gateway.php/firstfactory/v1/employees/60/tables/customProjectTracking') .reply(200, fixtures.projectTracking["60"]); }; const mockStatusForRequest = ((url: string, status: number, query: boolean = false) => { nock('https://api.bamboohr.com') .get(url) .query(query) .reply(status); }); export { mockRequests, mockStatusForRequest };