Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kentico-cloud-js-sdk-test-http-service

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kentico-cloud-js-sdk-test-http-service

[![npm](https://img.shields.io/npm/v/kentico-cloud-js-sdk-test-http-service.svg?maxAge=1000)](https://www.npmjs.com/package/kentico-cloud-js-sdk-test-http-service) [![npm](https://img.shields.io/npm/dt/kentico-cloud-js-sdk-test-http-service.svg?maxAge=100

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
4
Weekly downloads
 
Created
Source

Kentico Cloud JS SDK Test Http Service

npm npm npm Stack Overflow

Build Status dependency Status

Maintainability

This is source for npm package called kentico-cloud-js-sdk-test-http-service.

This package is meant to be used as a fake Http Service when testing Kentico Cloud Delivery SDK. It is basically an implementation of IHttpService that could be used when configuring Delivery client.

Install

With npm:

npm install kentico-cloud-js-sdk-test-http-service

Or with yarn

yarn add kentico-cloud-js-sdk-test-http-service

Usage

This it the example of the usage. Object fakeResponseConfig could contain multiple entries - entry is chosen by matching request url against the regular expression pattern provided as a key.

Full example is in delivery client tests.

const fakeResponseConfig = new Map<RegExp, FakeResponseConfig>()
fakeResponseConfig.set(
  // THIS IS A PATTERN THAT WOULD BE USED FOR MATCHING WHEN 
  // QUERYING THE DATA AGAINST THE URL
  /https:\/\/deliver.kenticocloud.com\/.*\/items/,  
  {
    // HERE YOU PROVIDE YOUR FAKE RESPONSE FOR THIS PATTERN
    fakeResponseJson: { 
      items: [
        {
          system: {...},
          elements: {...}
        }
      ],
      pagination: {
        continuation_token: null,
        next_page: null
      }
    },
    throwCloudError: false
  });

const fakeHttpService = 
 new KenticoCloudJsSdkTestHttpService(fakeResponseConfig);

const deliveryClientConfig = {
      projectId: 'dummyProject',
      typeResolvers: [],
      httpService: fakeHttpService
    };

const client = new DeliveryClient(deliveryClientConfig)

Author

Ondřej Chrastina — @Simply007

Thanks

Analytics

FAQs

Package last updated on 11 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc