Socket
Socket
Sign inDemoInstall

mappersmith

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mappersmith - npm Package Compare versions

Comparing version 2.29.0 to 2.29.1

2

mappersmith.js

@@ -16,3 +16,3 @@ "use strict";

/* global VERSION */
var version = "2.29.0";
var version = "2.29.1";
exports.version = version;

@@ -19,0 +19,0 @@ var configs = {

{
"name": "mappersmith",
"version": "2.29.0",
"version": "2.29.1",
"description": "It is a lightweight rest client for node.js and the browser",

@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>",

@@ -1211,3 +1211,3 @@ [![npm version](https://badge.fury.io/js/mappersmith.svg)](http://badge.fury.io/js/mappersmith)

#### Use the `mockClient` with TypeScript
#### Use `mockClient` with TypeScript

@@ -1244,2 +1244,19 @@ To use the `mockClient` with proper types you need to pass a typeof your client as generic to the `mockClient` function:

#### Use `mockRequest` with Typescript
```typescript
const mock = mockRequest({
method: 'get',
url: 'https://status.github.com/api/status.json',
response: {
status: 503,
body: { error: true },
}
})
console.log(mock.mostRecentCall())
console.log(mock.callsCount())
console.log(mock.calls())
```
## <a name="development"></a> Development

@@ -1246,0 +1263,0 @@

declare module 'mappersmith/test' {
import {Client, Parameters, Request} from 'mappersmith'
import { Client, Parameters, Request, Headers } from 'mappersmith'

@@ -27,2 +27,18 @@ export interface MockAssert {

export function mockClient<ResourcesType>(client: Client<ResourcesType>): MockClient<ResourcesType>
export type MockRequestUrlFunction = (requestUrl: string, params: object) => string
export type MockRequestBody = string | object
export type MockRequestBodyFunction = (requestBody: MockRequestBody) => MockRequestBody
export interface MockRequestArgs {
method: string
url: string | MockRequestUrlFunction
body?: MockRequestBody | MockRequestBodyFunction
response?: {
status?: number
body?: MockRequestBody
headers?: Headers
}
}
export function mockRequest(args: MockRequestArgs): MockAssert
}
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc