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/request / __tests__ / OneRequest.nock.test.ts
Size: Mime:
import nock from 'nock'
import '../src/deps/polyfill'
const urls = {
  bag: {
    add: `api/addtobag`,
    delete: `api/deletefrombag`,
    update: 'api/updatefrombag',
    view: 'api/viewbag',
  },
}

const addToBagData = `item={"skuId":"110001150","title":"Shirt","quantity":1,"itemType":"sku","itemid":"110001","customParams":{"categoryId":"plainteesmen"}}`
const deleteFromBagData = `item={"skuId":"110001150","title":"Shirt","quantity":1,"itemType":"sku","itemid":"110001","customParams":{"categoryId":"plainteesmen"}}`
const updateBagData = `item={"skuId":"81078","quantity":"2","itemType":"SKU","giftDetails":{"giftWrap":"false"},"id":"81078"}`

function useNock() {
  nock('http://localhost:3333')
    .get('/')
    .reply(200, { name: 'Michael' })
    .post(`/${urls.bag.add}`, addToBagData)
    .reply(201, { All: 'Good' })
    .log(console.log)
    .post(`/${urls.bag.delete}`, deleteFromBagData)
    .reply(201, { All: 'Good' })
    .log(console.log)
    .post(`/${urls.bag.update}`, updateBagData)
    .reply(201, { All: 'Good' })
    .log(console.log)
    .get(`/${urls.bag.view}`)
    .reply(200, { All: 'Good' })
    .log(console.log)
    .post(`/serialize`)
    .reply(201, 'All Good')
    .log(console.log)
}

describe('should nock it up for #NOCKEDUP', () => {
  it.skip('@todo @michael', () => {
    //
  })
})