Repository URL to install this package:
|
Version:
1.3.3 ▾
|
import nock from 'nock'
import {
productListBaseUrl,
productBaseUrl,
searchBaseUrl,
searchsuggestionBaseUrl,
} from '../bootstrapper/api/config'
import {
getProductList,
getProduct,
getSearch,
getSearchSuggestions,
} from '../endpoints/catalog/requests.GET'
import {
productListParams,
searchParams,
searchSuggestionParams,
productParams,
} from '../endpoints/catalog/defaultParams'
import {
fixtureProductListData,
fixtureProductData,
fixtureSearchData,
fixtureSearchSuggestionData,
} from '../endpoints/catalog/fixtures'
describe('How Nock Works', () => {
describe('with ProductList', () => {
let scope
beforeEach(() => {
// @note - this is done by using .toMock
scope = nock(productListBaseUrl)
.get('/fashionmen')
.query(productListParams)
.reply(200, fixtureProductListData)
})
afterEach(() => {
nock.cleanAll()
})
it('should reply with a fixture', async () => {
// const response = await getProductList({}, 'fashionmen')
console.warn('@michael - need to update params')
const response = await getProductList.path('fashionmen').doRequest()
expect(typeof response).toBe('object')
})
})
describe.skip('with ProductDetail', () => {
beforeEach(() => {})
afterEach(() => {})
})
describe.skip('with Search', () => {
beforeEach(() => {})
afterEach(() => {})
})
describe.skip('with Search Suggestions', () => {
beforeEach(() => {})
afterEach(() => {})
})
})