Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/graphql / src / __tests__ / nock.test.ts
Size: Mime:
import nock from 'nock'
import {
  productListBaseUrl,
  productBaseUrl,
  searchBaseUrl,
  searchsuggestionBaseUrl,
} from '../bootstrapper/api/config'
import {
  getProductList,
  getProduct,
  getSearch,
  getSearchSuggestions,
} from '../endpoints/catalog/stream/requests'
import {
  productListParams,
  searchParams,
  searchSuggestionParams,
  productParams,
} from '../endpoints/catalog/stream/defaultParams'
import {
  fixtureProductListData,
  fixtureProductData,
  fixtureSearchData,
  fixtureSearchSuggestionData,
} from '../endpoints/catalog/stream/fixtures'

// skip till until its revisited
describe.skip('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.body).toBe('object')
    })
  })
  describe.skip('with ProductDetail', () => {
    beforeEach(() => {})
    afterEach(() => {})
  })
  describe.skip('with Search', () => {
    beforeEach(() => {})
    afterEach(() => {})
  })
  describe.skip('with Search Suggestions', () => {
    beforeEach(() => {})
    afterEach(() => {})
  })
})