@natlibfi/melinda-commons 12.0.2 → 12.0.3-alpha.1

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.
package/dist/error.js CHANGED
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
+
10
12
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
13
 
12
14
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
@@ -70,7 +72,7 @@ var _default = /*#__PURE__*/function (_Error) {
70
72
  return _this;
71
73
  }
72
74
 
73
- return _default;
75
+ return (0, _createClass2.default)(_default);
74
76
  }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
75
77
 
76
78
  exports.default = _default;
package/dist/error.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/error.js"],"names":["status","payload","params","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGE,oBAAYA,MAAZ,EAAoBC,OAApB,EAAwC;AAAA;;AAAA;;AAAA,sCAARC,MAAQ;AAARA,MAAAA,MAAQ;AAAA;;AACtC,8BAAMA,MAAN;AACA,UAAKF,MAAL,GAAcA,MAAd,CAFsC,CAEhB;;AACtB,UAAKC,OAAL,GAAeA,OAAf,CAHsC,CAGd;;AAHc;AAIvC;;;+CAL0BE,K","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2021 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport default class extends Error {\n constructor(status, payload, ...params) {\n super(params);\n this.status = status; // eslint-disable-line functional/no-this-expression\n this.payload = payload; // eslint-disable-line functional/no-this-expression\n }\n}\n"],"file":"error.js"}
1
+ {"version":3,"sources":["../src/error.js"],"names":["status","payload","params","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGE,oBAAYA,MAAZ,EAAoBC,OAApB,EAAwC;AAAA;;AAAA;;AAAA,sCAARC,MAAQ;AAARA,MAAAA,MAAQ;AAAA;;AACtC,8BAAMA,MAAN;AACA,UAAKF,MAAL,GAAcA,MAAd,CAFsC,CAEhB;;AACtB,UAAKC,OAAL,GAAeA,OAAf,CAHsC,CAGd;;AAHc;AAIvC;;;+CAL0BE,K","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2021 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nexport default class extends Error {\n constructor(status, payload, ...params) {\n super(params);\n this.status = status; // eslint-disable-line functional/no-this-expression\n this.payload = payload; // eslint-disable-line functional/no-this-expression\n }\n}\n"],"file":"error.js"}
@@ -18,6 +18,8 @@ var _fixugenHttpClient = _interopRequireDefault(require("@natlibfi/fixugen-http-
18
18
 
19
19
  var _marcRecord = require("@natlibfi/marc-record");
20
20
 
21
+ var _debug = _interopRequireDefault(require("debug"));
22
+
21
23
  /**
22
24
  *
23
25
  * @licstart The following is the entire license notice for the JavaScript code in this file.
@@ -45,6 +47,7 @@ var _marcRecord = require("@natlibfi/marc-record");
45
47
  * for the JavaScript code in this file.
46
48
  *
47
49
  */
50
+ var debug = (0, _debug.default)('@natlibfi/melinda-commons:subRecordPicker:test');
48
51
  describe('subRecordPicker', function () {
49
52
  var sruUrl = 'https://sru';
50
53
  var retrieveAll = false;
@@ -74,7 +77,7 @@ describe('subRecordPicker', function () {
74
77
 
75
78
  function _callback() {
76
79
  _callback = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
77
- var getFixture, method, sruUrl, retrieveAll, recordId, client, expectedRecords, _yield$client$method, records, _records, record, format;
80
+ var getFixture, method, sruUrl, retrieveAll, recordId, client, expectedRecords, _yield$client$method, records, _records, recordObject, record, format;
78
81
 
79
82
  return _regenerator.default.wrap(function _callee$(_context) {
80
83
  while (1) {
@@ -99,11 +102,14 @@ describe('subRecordPicker', function () {
99
102
  _yield$client$method = _context.sent;
100
103
  records = _yield$client$method.records;
101
104
  // Expect records to be marc records
102
- _records = (0, _slicedToArray2.default)(records, 1), record = _records[0];
105
+ _records = (0, _slicedToArray2.default)(records, 1), recordObject = _records[0];
106
+ debug(recordObject);
107
+ record = new _marcRecord.MarcRecord(recordObject);
108
+ debug(record);
103
109
  (0, _chai.expect)(record).to.be.instanceof(_marcRecord.MarcRecord);
104
110
  (0, _chai.expect)(format()).to.eql(expectedRecords);
105
111
 
106
- case 11:
112
+ case 14:
107
113
  case "end":
108
114
  return _context.stop();
109
115
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/subRecordPicker.spec.js"],"names":["describe","sruUrl","retrieveAll","it","client","to","respondTo","createSubrecordPicker","throw","callback","path","__dirname","format","records","map","r","toObject","getFixture","method","recordId","expectedRecords","components","reader","READERS","JSON","record","be","instanceof","MarcRecord","eql"],"mappings":";;;;;;;;;;AA4BA;;AACA;;AACA;;AACA;;AACA;;AAhCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQAA,QAAQ,CAAC,iBAAD,EAAoB,YAAM;AAChC,MAAMC,MAAM,GAAG,aAAf;AACA,MAAMC,WAAW,GAAG,KAApB;AAEAF,EAAAA,QAAQ,CAAC,uBAAD,EAA0B,YAAM;AACtCG,IAAAA,EAAE,CAAC,4BAAD,EAA+B,YAAM;AACrC,UAAMC,MAAM,GAAG,4CAAsBH,MAAtB,EAA8BC,WAA9B,CAAf;AACA,wBAAOE,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,mBAA5B;AACA,wBAAOF,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,oBAA5B;AACD,KAJC,CAAF;AAMAH,IAAAA,EAAE,CAAC,oDAAD,EAAuD,YAAM;AAC7D,UAAMC,MAAM,GAAG,4CAAsBH,MAAtB,CAAf;AACA,wBAAOG,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,mBAA5B;AACA,wBAAOF,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,C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CAAwBT,eAAxB;;AARF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KA3BgC;AAAA;AAAA;AAyCjC,CAzCO,CAAR","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2021 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {expect} from 'chai';\nimport {createSubrecordPicker} from './subRecordPicker';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen-http-client';\nimport {MarcRecord} from '@natlibfi/marc-record';\n\ndescribe('subRecordPicker', () => {\n const sruUrl = 'https://sru';\n const retrieveAll = false;\n\n describe('createSubrecordPicker', () => {\n it('Client should have methods', () => {\n const client = createSubrecordPicker(sruUrl, retrieveAll);\n expect(client).to.respondTo('readAllSubrecords');\n expect(client).to.respondTo('readSomeSubrecords');\n });\n\n it('Create client should work with just one parametter', () => {\n const client = createSubrecordPicker(sruUrl);\n expect(client).to.respondTo('readAllSubrecords');\n expect(client).to.respondTo('readSomeSubrecords');\n });\n\n it('Create client should have at least one parametter', () => {\n expect(createSubrecordPicker).to.throw();\n });\n });\n\n generateTests({\n callback,\n path: [__dirname, '..', 'test-fixtures', 'subRecordPicker']\n });\n\n async function callback({getFixture, method, sruUrl, retrieveAll, recordId}) {\n const client = createSubrecordPicker(sruUrl, retrieveAll);\n const expectedRecords = getFixture({components: ['expected-records.json'], reader: READERS.JSON});\n const {records} = await client[method](recordId);\n\n // Expect records to be marc records\n const [record] = records;\n expect(record).to.be.instanceof(MarcRecord);\n expect(format()).to.eql(expectedRecords);\n\n function format() {\n return records.map(r => r.toObject());\n }\n }\n});\n"],"file":"subRecordPicker.spec.js"}
1
+ {"version":3,"sources":["../src/subRecordPicker.spec.js"],"names":["debug","describe","sruUrl","retrieveAll","it","client","to","respondTo","createSubrecordPicker","throw","callback","path","__dirname","format","records","map","r","toObject","getFixture","method","recordId","expectedRecords","components","reader","READERS","JSON","recordObject","record","MarcRecord","be","instanceof","eql"],"mappings":";;;;;;;;;;AA4BA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA,IAAMA,KAAK,GAAG,oBAAkB,gDAAlB,CAAd;AAEAC,QAAQ,CAAC,iBAAD,EAAoB,YAAM;AAChC,MAAMC,MAAM,GAAG,aAAf;AACA,MAAMC,WAAW,GAAG,KAApB;AAEAF,EAAAA,QAAQ,CAAC,uBAAD,EAA0B,YAAM;AACtCG,IAAAA,EAAE,CAAC,4BAAD,EAA+B,YAAM;AACrC,UAAMC,MAAM,GAAG,4CAAsBH,MAAtB,EAA8BC,WAA9B,CAAf;AACA,wBAAOE,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,mBAA5B;AACA,wBAAOF,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,oBAA5B;AACD,KAJC,CAAF;AAMAH,IAAAA,EAAE,CAAC,oDAAD,EAAuD,YAAM;AAC7D,UAAMC,MAAM,GAAG,4CAAsBH,MAAtB,CAAf;AACA,wBAAOG,MAAP,EAAeC,EAAf,CAAkBC,SAAlB,CAA4B,mBAA5B;AACA,wBAAOF,MAAP,EAAeC,EA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AAK,CAAC2B,MAAD,CAAL;AAEA,gCAAOA,MAAP,EAAerB,EAAf,CAAkBuB,EAAlB,CAAqBC,UAArB,CAAgCF,sBAAhC;AACA,gCAAOf,MAAM,EAAb,EAAiBP,EAAjB,CAAoByB,GAApB,CAAwBV,eAAxB;;AAZF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KA3BgC;AAAA;AAAA;AA6CjC,CA7CO,CAAR","sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* Shared modules for Melinda's software\n*\n* Copyright (C) 2018-2021 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of melinda-commons-js\n*\n* melinda-commons-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Lesser General Public License as\n* published by the Free Software Foundation, either version 3 of the\n* License, or (at your option) any later version.\n*\n* melinda-commons-js is distributed in the hope that it will be useful,\n* but WITHOUT ANY WARRANTY; without even the implied warranty of\n* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n* GNU Lesser General Public License for more details.\n*\n* You should have received a copy of the GNU Lesser General Public License\n* along with this program. If not, see <http://www.gnu.org/licenses/>.\n*\n* @licend The above is the entire license notice\n* for the JavaScript code in this file.\n*\n*/\n\nimport {expect} from 'chai';\nimport {createSubrecordPicker} from './subRecordPicker';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen-http-client';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport createDebugLogger from 'debug';\n\nconst debug = createDebugLogger('@natlibfi/melinda-commons:subRecordPicker:test');\n\ndescribe('subRecordPicker', () => {\n const sruUrl = 'https://sru';\n const retrieveAll = false;\n\n describe('createSubrecordPicker', () => {\n it('Client should have methods', () => {\n const client = createSubrecordPicker(sruUrl, retrieveAll);\n expect(client).to.respondTo('readAllSubrecords');\n expect(client).to.respondTo('readSomeSubrecords');\n });\n\n it('Create client should work with just one parametter', () => {\n const client = createSubrecordPicker(sruUrl);\n expect(client).to.respondTo('readAllSubrecords');\n expect(client).to.respondTo('readSomeSubrecords');\n });\n\n it('Create client should have at least one parametter', () => {\n expect(createSubrecordPicker).to.throw();\n });\n });\n\n generateTests({\n callback,\n path: [__dirname, '..', 'test-fixtures', 'subRecordPicker']\n });\n\n async function callback({getFixture, method, sruUrl, retrieveAll, recordId}) {\n const client = createSubrecordPicker(sruUrl, retrieveAll);\n const expectedRecords = getFixture({components: ['expected-records.json'], reader: READERS.JSON});\n const {records} = await client[method](recordId);\n\n // Expect records to be marc records\n const [recordObject] = records;\n debug(recordObject);\n const record = new MarcRecord(recordObject);\n debug(record);\n\n expect(record).to.be.instanceof(MarcRecord);\n expect(format()).to.eql(expectedRecords);\n\n function format() {\n return records.map(r => r.toObject());\n }\n }\n});\n"],"file":"subRecordPicker.spec.js"}
package/dist/utils.js CHANGED
@@ -20,7 +20,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
20
20
 
21
21
  var _setPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/setPrototypeOf"));
22
22
 
23
- function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return (0, _setPrototypeOf2.default)(_this, BabelRegExp.prototype); } (0, _inherits2.default)(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (_typeof(args[args.length - 1]) !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
23
+ function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, void 0, groups); }; var _super = RegExp.prototype, _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); return _groups.set(_this, groups || _groups.get(re)), (0, _setPrototypeOf2.default)(_this, BabelRegExp.prototype); } function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { return groups[name] = result[g[name]], groups; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); return result && (result.groups = buildGroups(result, this)), result; }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if ("string" == typeof substitution) { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } if ("function" == typeof substitution) { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); }); } return _super[Symbol.replace].call(this, str, substitution); }, _wrapRegExp.apply(this, arguments); }
24
24
 
25
25
  /**
26
26
  *
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "url": "git@github.com:natlibfi/melinda-commons-js.git"
15
15
  },
16
16
  "license": "LGPL-3.0+",
17
- "version": "12.0.2",
17
+ "version": "12.0.3-alpha.1",
18
18
  "main": "./dist/index.js",
19
19
  "engines": {
20
20
  "node": ">=14"
@@ -34,34 +34,34 @@
34
34
  "watch:test": "cross-env DEBUG=1 NODE_ENV=test nodemon -w src -w test-fixtures --exec 'npm run test:dev'"
35
35
  },
36
36
  "dependencies": {
37
- "@natlibfi/marc-record": "^6.1.2",
38
- "@natlibfi/marc-record-serializers": "^8.0.4",
39
- "@natlibfi/sru-client": "^4.1.0",
40
- "debug": "^4.3.2",
37
+ "@natlibfi/marc-record": "^7.0.0",
38
+ "@natlibfi/marc-record-serializers": "^8.1.0",
39
+ "@natlibfi/sru-client": "^5.0.1",
40
+ "debug": "^4.3.3",
41
41
  "deep-eql": "^4.0.0",
42
42
  "http-status": "^1.5.0",
43
43
  "moment": "^2.29.1",
44
- "nock": "^13.1.4",
45
- "node-fetch": "^2.6.1"
44
+ "nock": "^13.2.2",
45
+ "node-fetch": "^2.6.7"
46
46
  },
47
47
  "devDependencies": {
48
- "@babel/cli": "^7.15.7",
49
- "@babel/core": "^7.15.8",
50
- "@babel/eslint-parser": "^7.15.8",
51
- "@babel/node": "^7.15.8",
52
- "@babel/plugin-transform-runtime": "^7.15.8",
53
- "@babel/preset-env": "^7.15.8",
54
- "@babel/register": "^7.15.3",
55
- "@natlibfi/eslint-config-melinda-backend": "^1.1.1",
48
+ "@babel/cli": "^7.16.8",
49
+ "@babel/core": "^7.16.12",
50
+ "@babel/eslint-parser": "^7.16.5",
51
+ "@babel/node": "^7.16.8",
52
+ "@babel/plugin-transform-runtime": "^7.16.10",
53
+ "@babel/preset-env": "^7.16.11",
54
+ "@babel/register": "^7.16.9",
55
+ "@natlibfi/eslint-config-melinda-backend": "^2.0.0",
56
56
  "@natlibfi/fixugen-http-client": "^1.1.3",
57
57
  "@natlibfi/fixura": "^2.2.1",
58
58
  "babel-plugin-istanbul": "^6.1.1",
59
59
  "babel-plugin-rewire": "^1.2.0",
60
- "chai": "^4.3.4",
60
+ "chai": "^4.3.6",
61
61
  "cross-env": "^7.0.3",
62
- "eslint": "^7.32.0",
63
- "mocha": "^9.1.3",
64
- "nodemon": "^2.0.14",
62
+ "eslint": "^8.8.0",
63
+ "mocha": "^9.2.0",
64
+ "nodemon": "^2.0.15",
65
65
  "nyc": "^15.1.0"
66
66
  },
67
67
  "eslintConfig": {
@@ -31,6 +31,9 @@ import {createSubrecordPicker} from './subRecordPicker';
31
31
  import {READERS} from '@natlibfi/fixura';
32
32
  import generateTests from '@natlibfi/fixugen-http-client';
33
33
  import {MarcRecord} from '@natlibfi/marc-record';
34
+ import createDebugLogger from 'debug';
35
+
36
+ const debug = createDebugLogger('@natlibfi/melinda-commons:subRecordPicker:test');
34
37
 
35
38
  describe('subRecordPicker', () => {
36
39
  const sruUrl = 'https://sru';
@@ -65,7 +68,11 @@ describe('subRecordPicker', () => {
65
68
  const {records} = await client[method](recordId);
66
69
 
67
70
  // Expect records to be marc records
68
- const [record] = records;
71
+ const [recordObject] = records;
72
+ debug(recordObject);
73
+ const record = new MarcRecord(recordObject);
74
+ debug(record);
75
+
69
76
  expect(record).to.be.instanceof(MarcRecord);
70
77
  expect(format()).to.eql(expectedRecords);
71
78