node-tdd 6.0.1 → 6.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,14 +13,6 @@ export const tryParseJson = (value) => {
13
13
 
14
14
  export const nullAsString = (value) => (value === null ? 'null' : value);
15
15
 
16
- export const convertHeaders = (array) => {
17
- const obj = {};
18
- for (let idx = 0; idx < array.length; idx += 2) {
19
- obj[array[idx].toLowerCase()] = array[idx + 1];
20
- }
21
- return obj;
22
- };
23
-
24
16
  export const rewriteHeaders = (headers, fn = (k, v) => v) => {
25
17
  if (headers === undefined) {
26
18
  return {};
@@ -1,5 +1,6 @@
1
1
  import assert from 'assert';
2
2
  import http from 'http';
3
+ import https from 'https';
3
4
  import path from 'path';
4
5
  import fs from 'smart-fs';
5
6
  import Joi from 'joi-strict';
@@ -18,7 +19,6 @@ import {
18
19
  buildKey,
19
20
  tryParseJson,
20
21
  nullAsString,
21
- convertHeaders,
22
22
  rewriteHeaders
23
23
  } from './request-recorder/util.js';
24
24
  import updateAndRestoreModifiers from './request-recorder/update-and-restore-modifiers.js';
@@ -117,7 +117,7 @@ export default (opts) => {
117
117
  });
118
118
  await new Promise((resolve) => {
119
119
  options.protocol = `${protocol}:`;
120
- const r = { http, https: http }[protocol].request(options, (response) => {
120
+ const r = { http, https }[protocol].request(options, (response) => {
121
121
  response.on('data', () => {});
122
122
  response.on('end', resolve);
123
123
  });
@@ -129,7 +129,7 @@ export default (opts) => {
129
129
  const recorded = nockRecorder.play();
130
130
  nockRecorder.clear();
131
131
  return recorded.map((record) => Object.assign(record, {
132
- headers: opts.stripHeaders === true ? undefined : convertHeaders(record.rawHeaders),
132
+ headers: opts.stripHeaders === true ? undefined : rewriteHeaders(record.rawHeaders),
133
133
  rawHeaders: undefined,
134
134
  reqheaders: rewriteHeaders(record.reqheaders, overwriteHeaders)
135
135
  }));
@@ -235,7 +235,8 @@ export default (opts) => {
235
235
 
236
236
  if (anyFlagPresent(['magic', 'response'])) {
237
237
  const responseBody = tryParseJson([
238
- healSqs
238
+ healSqs,
239
+ (_, b) => (b instanceof Buffer ? b.toString('hex') : b)
239
240
  ].reduce(
240
241
  (respBody, fn) => fn(requestBodyString, respBody, scope, req),
241
242
  interceptor.body
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-tdd",
3
3
  "type": "module",
4
- "version": "6.0.1",
4
+ "version": "6.0.3",
5
5
  "description": "Drop in extension for mocha to abstract commonly used test setups",
6
6
  "main": "lib/index.js",
7
7
  "scripts": {
@@ -41,24 +41,24 @@
41
41
  },
42
42
  "homepage": "https://github.com/blackflux/node-tdd#readme",
43
43
  "devDependencies": {
44
- "@aws-sdk/client-sqs": "3.734.0",
45
- "@babel/core": "7.26.7",
46
- "@babel/eslint-parser": "7.26.5",
44
+ "@aws-sdk/client-sqs": "3.758.0",
45
+ "@babel/core": "7.26.10",
46
+ "@babel/eslint-parser": "7.26.10",
47
47
  "@babel/register": "7.25.9",
48
+ "@blackflux/axios": "3.0.2",
48
49
  "@blackflux/eslint-plugin-rules": "4.0.1",
49
- "@blackflux/robo-config-plugin": "10.0.2",
50
- "aws-sdk-wrap": "14.0.0",
51
- "axios": "1.7.9",
50
+ "@blackflux/robo-config-plugin": "10.0.4",
51
+ "aws-sdk-wrap": "14.0.1",
52
52
  "c8": "10.1.3",
53
- "chai": "5.1.2",
54
- "eslint": "9.19.0",
53
+ "chai": "5.2.0",
54
+ "eslint": "9.22.0",
55
55
  "eslint-config-airbnb-base": "15.0.0",
56
56
  "eslint-plugin-import": "2.31.0",
57
57
  "eslint-plugin-json": "4.0.1",
58
58
  "eslint-plugin-markdown": "5.1.0",
59
59
  "eslint-plugin-mocha": "10.5.0",
60
60
  "fancy-log": "2.0.0",
61
- "js-gardener": "6.0.3",
61
+ "js-gardener": "6.0.4",
62
62
  "lambda-monitor-logger": "6.0.1"
63
63
  },
64
64
  "licenses": [
@@ -80,10 +80,10 @@
80
80
  "lodash.get": "4.4.2",
81
81
  "lru-cache-ext": "5.0.1",
82
82
  "minimist": "1.2.8",
83
- "nock": "13.5.4",
83
+ "nock": "14.0.1",
84
84
  "normalize-url": "2.0.1",
85
85
  "object-scan": "20.0.1",
86
- "smart-fs": "5.0.1",
86
+ "smart-fs": "5.0.2",
87
87
  "timekeeper": "2.3.1",
88
88
  "tmp": "0.2.3",
89
89
  "xml2js": "0.6.2"