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

@bielik/express-test-helpers

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bielik/express-test-helpers - npm Package Compare versions

Comparing version 1.2.4 to 1.2.5

3

index.js

@@ -17,2 +17,3 @@ "use strict";

var app_1 = (0, express_1.default)();
app_1.disable('x-powered-by');
var server_1 = app_1.listen(port, function () {

@@ -67,3 +68,3 @@ exports.servers.push({ server: server_1, app: app_1, port: port });

serverAndPort = servers_1[_i];
if (!(serverAndPort.port === portToClose && serverAndPort.server.close)) return [3 /*break*/, 3];
if (!(serverAndPort.port === portToClose && !!serverAndPort.server.close)) return [3 /*break*/, 3];
return [4 /*yield*/, _close(serverAndPort.server)];

@@ -70,0 +71,0 @@ case 2:

@@ -20,2 +20,3 @@ import express from 'express';

const app = express();
app.disable('x-powered-by');
let server = app.listen(port, () => {

@@ -50,3 +51,3 @@ servers.push({ server, app, port });

for (const serverAndPort of servers) {
if (serverAndPort.port === portToClose && serverAndPort.server.close) {
if (serverAndPort.port === portToClose && !!serverAndPort.server.close) {
await _close(serverAndPort.server);

@@ -53,0 +54,0 @@ servers.splice(

{
"name": "@bielik/express-test-helpers",
"version": "1.2.4",
"version": "1.2.5",
"description": "Unit test helper functions for node/express",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -69,5 +69,5 @@ "use strict";

return tslib_1.__awaiter(this, void 0, void 0, function () {
var payload, uri, body;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
var payload, uri, _b, body, headers;
return tslib_1.__generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -79,6 +79,7 @@ payload = 'body';

});
return [4 /*yield*/, (0, request_1.default)({ uri: uri })];
return [4 /*yield*/, (0, request_1.default)({ uri: uri }, true)];
case 1:
body = _b.sent();
_b = _c.sent(), body = _b.body, headers = _b.headers;
(0, chai_1.expect)(body).to.equal(payload);
(0, chai_1.expect)(headers['x-powered-by']).to.be.a(typeof undefined);
return [2 /*return*/];

@@ -85,0 +86,0 @@ }

@@ -41,3 +41,3 @@ //@ts-check

expect(servers.length).to.equal(apps.length);
let test = async function ({
const test = async function ({
app,

@@ -49,4 +49,4 @@ port,

}) {
let payload = 'body';
let uri = `http://localhost:${port}/any`;
const payload = 'body';
const uri = `http://localhost:${port}/any`;
app.get('*', (req, res) => {

@@ -56,4 +56,8 @@ res.send(payload);

var body = await request({ uri });
const { body, headers } = await request<{ body: any; headers: any }>(
{ uri },
true
);
expect(body).to.equal(payload);
expect(headers['x-powered-by']).to.be.a(typeof undefined);
};

@@ -65,5 +69,5 @@

let testPort = 7777;
const testPort = 7777;
try {
let uri = `http://localhost:${testPort}/any`;
const uri = `http://localhost:${testPort}/any`;
await request({ uri });

@@ -70,0 +74,0 @@ expect('request after server closed').to.equal('should have thrown');

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