node-tdd 6.2.0 → 6.2.2

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,6 +13,14 @@ 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
+
16
24
  export const rewriteHeaders = (headers, fn = (k, v) => v) => {
17
25
  if (headers === undefined) {
18
26
  return {};
@@ -20,7 +20,8 @@ import {
20
20
  buildKey,
21
21
  tryParseJson,
22
22
  nullAsString,
23
- rewriteHeaders
23
+ rewriteHeaders,
24
+ convertHeaders
24
25
  } from './request-recorder/util.js';
25
26
 
26
27
  const nockBack = nock.back;
@@ -271,7 +272,7 @@ export default (opts) => {
271
272
  afterRecord: (recordings) => JSON.stringify(recordings.map((r) => ({
272
273
  ...r,
273
274
  body: tryParseJson(r.body),
274
- rawHeaders: opts.stripHeaders === true ? undefined : r.rawHeaders,
275
+ rawHeaders: opts.stripHeaders === true ? undefined : convertHeaders(r.rawHeaders),
275
276
  reqheaders: rewriteHeaders(r.reqheaders, overwriteHeaders)
276
277
  })), null, 2)
277
278
  }, resolve);
@@ -7,5 +7,8 @@ export default (firstUrl, secondUrl) => {
7
7
  const options = {
8
8
  removeTrailingSlash: false
9
9
  };
10
- return normalizeUrl(firstUrl, options) === normalizeUrl(secondUrl, options);
10
+ return (
11
+ normalizeUrl(`https://test.com${firstUrl}`, options)
12
+ === normalizeUrl(`https://test.com${secondUrl}`, options)
13
+ );
11
14
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "node-tdd",
3
3
  "type": "module",
4
- "version": "6.2.0",
4
+ "version": "6.2.2",
5
5
  "description": "Drop in extension for mocha to abstract commonly used test setups",
6
6
  "main": "lib/index.js",
7
7
  "scripts": {
@@ -80,8 +80,8 @@
80
80
  "lodash.get": "4.4.2",
81
81
  "lru-cache-ext": "5.0.1",
82
82
  "minimist": "1.2.8",
83
- "nock": "14.0.5",
84
- "normalize-url": "2.0.1",
83
+ "nock": "13.5.6",
84
+ "normalize-url": "8.1.0",
85
85
  "object-scan": "20.0.1",
86
86
  "smart-fs": "5.0.2",
87
87
  "timekeeper": "2.3.1",