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

@shopify/jest-koa-mocks

Package Overview
Dependencies
Maintainers
24
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/jest-koa-mocks - npm Package Compare versions

Comparing version 5.1.1 to 5.2.0

18

build/cjs/create-mock-context/create-mock-context.js

@@ -34,3 +34,4 @@ 'use strict';

} = options;
const extensions = { ...customProperties,
const extensions = {
...customProperties,
throw: throwFn,

@@ -51,5 +52,6 @@ session,

}
}); // Some functions we call in the implementations will perform checks for `req.encrypted`, which delegates to the socket.
});
// Some functions we call in the implementations will perform checks for `req.encrypted`, which delegates to the socket.
// MockRequest doesn't set a fake socket itself, so we create one here.
req.socket = new stream__default["default"].Duplex();

@@ -60,6 +62,9 @@ Object.defineProperty(req.socket, 'encrypted', {

});
const res = httpMocks__default["default"].createResponse(); // Koa sets a default status code of 404, not the node default of 200
const res = httpMocks__default["default"].createResponse();
// Koa sets a default status code of 404, not the node default of 200
// https://github.com/koajs/koa/blob/master/docs/api/response.md#responsestatus
res.statusCode = 404;
res.statusCode = 404; // This is to get around an odd behavior in the `cookies` library, where if `res.set` is defined, it will use an internal
// This is to get around an odd behavior in the `cookies` library, where if `res.set` is defined, it will use an internal
// node function to set headers, which results in them being set in the wrong place.

@@ -70,4 +75,5 @@

Object.assign(context, extensions);
context.cookies = createMockCookies["default"](cookies); // ctx.request.body is a common enough custom property for middleware to add that it's handy to just support it by default
context.cookies = createMockCookies["default"](cookies);
// ctx.request.body is a common enough custom property for middleware to add that it's handy to just support it by default
context.request.body = requestBody;

@@ -74,0 +80,0 @@ context.request.rawBody = rawBody;

{
"name": "@shopify/jest-koa-mocks",
"version": "5.1.1",
"version": "5.2.0",
"license": "MIT",

@@ -23,3 +23,3 @@ "description": "Utilities to easily stub Koa context and cookies",

"engines": {
"node": "^14.17.0 || >=16.0.0"
"node": ">=18.12.0"
},

@@ -26,0 +26,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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