@natlibfi/oracledb-mock 1.0.2-alpha.1 → 1.0.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.
@@ -10,7 +10,7 @@ updates:
10
10
  interval: "daily"
11
11
  time: "06:30"
12
12
  timezone: "Europe/Helsinki"
13
- target-branch: "dependencies"
13
+ target-branch: "test"
14
14
 
15
15
  # Minor updates to npm production dependencies daily
16
16
  - package-ecosystem: "npm"
@@ -20,9 +20,14 @@ updates:
20
20
  time: "06:45"
21
21
  timezone: "Europe/Helsinki"
22
22
  versioning-strategy: lockfile-only
23
- allow:
24
- - dependency-type: "production"
25
- target-branch: "dependencies"
23
+ target-branch: "test"
24
+ pull-request-branch-name:
25
+ separator: "-"
26
+ groups:
27
+ production-dependencies:
28
+ dependency-type: "production"
29
+ development-dependencies:
30
+ dependency-type: "development"
26
31
 
27
32
  # Major updates to npm dependencies weekly @tuesday
28
33
  # Not possible yet https://github.com/dependabot/dependabot-core/issues/1778
@@ -11,7 +11,7 @@ jobs:
11
11
 
12
12
  strategy:
13
13
  matrix:
14
- node-version: [18.x, 19.x]
14
+ node-version: [18.x, 19.x, 20.x]
15
15
  # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
16
16
 
17
17
  steps:
package/dist/index.js CHANGED
@@ -53,7 +53,6 @@ var _default = () => {
53
53
  close: () => {} // eslint-disable-line no-empty-function
54
54
  }
55
55
  };
56
-
57
56
  function getRows() {
58
57
  const index = options.findIndex(({
59
58
  queryPattern,
@@ -80,13 +79,11 @@ var _default = () => {
80
79
  getConnection: () => connection,
81
80
  close: () => {} // eslint-disable-line no-empty-function
82
81
  }),
83
-
84
82
  _clear: () => {
85
83
  // Clear array
86
84
  options.splice(0); // eslint-disable-line functional/immutable-data
87
85
  Object.keys(options).forEach(k => delete options[k]); // eslint-disable-line functional/immutable-data
88
86
  },
89
-
90
87
  _execute: optList => {
91
88
  // Clear array
92
89
  options.splice(0); // eslint-disable-line functional/immutable-data
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_deepEql","_interopRequireDefault","require","obj","__esModule","default","_default","options","DEFAULT_OPTIONS","queryPattern","results","connection","close","break","execute","query","args","rows","getRows","resultSet","getRow","shift","index","findIndex","expectedArgs","test","undefined","deepEqual","splice","getConnection","createPool","_clear","Object","keys","forEach","k","_execute","optList","opts","push","exports"],"sources":["../src/index.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* A mock for oracledb Node.js module\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of oracledb-mock-js\n*\n* oracledb-mock-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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* oracledb-mock-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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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 deepEqual from 'deep-eql';\n\nexport default () => {\n const options = [];\n const DEFAULT_OPTIONS = {\n queryPattern: /.*/u,\n results: []\n };\n\n const connection = {\n close: () => {}, // eslint-disable-line no-empty-function\n break: () => {}, // eslint-disable-line no-empty-function\n execute: (query, args) => {\n const rows = getRows();\n\n return {\n resultSet: {\n getRow: () => rows.shift(), // eslint-disable-line functional/immutable-data\n close: () => {} // eslint-disable-line no-empty-function\n }\n };\n\n function getRows() {\n const index = options.findIndex(({queryPattern, expectedArgs}) => {\n if (queryPattern.test(query) && (expectedArgs === undefined || deepEqual(args, expectedArgs))) {\n return true;\n }\n\n return false;\n });\n\n if (index >= 0) {\n const {results} = options.splice(index, 1).shift(); // eslint-disable-line functional/immutable-data\n return results;\n }\n\n return [];\n }\n }\n };\n\n return {\n getConnection: () => connection,\n createPool: () => ({\n getConnection: () => connection,\n close: () => {} // eslint-disable-line no-empty-function\n }),\n _clear: () => {\n // Clear array\n options.splice(0); // eslint-disable-line functional/immutable-data\n Object.keys(options).forEach(k => delete options[k]); // eslint-disable-line functional/immutable-data\n },\n _execute: optList => {\n // Clear array\n options.splice(0); // eslint-disable-line functional/immutable-data\n\n optList.forEach(opts => {\n options.push({...DEFAULT_OPTIONS, ...opts}); // eslint-disable-line functional/immutable-data\n });\n }\n };\n};\n"],"mappings":";;;;;;AA4BA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA5BjC;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;AA1BA,IAAAG,QAAA,GA8BeA,CAAA,KAAM;EACnB,MAAMC,OAAO,GAAG,EAAE;EAClB,MAAMC,eAAe,GAAG;IACtBC,YAAY,EAAE,KAAK;IACnBC,OAAO,EAAE;EACX,CAAC;EAED,MAAMC,UAAU,GAAG;IACjBC,KAAK,EAAEA,CAAA,KAAM,CAAC,CAAC;IAAE;IACjBC,KAAK,EAAEA,CAAA,KAAM,CAAC,CAAC;IAAE;IACjBC,OAAO,EAAEA,CAACC,KAAK,EAAEC,IAAI,KAAK;MACxB,MAAMC,IAAI,GAAGC,OAAO,CAAC,CAAC;MAEtB,OAAO;QACLC,SAAS,EAAE;UACTC,MAAM,EAAEA,CAAA,KAAMH,IAAI,CAACI,KAAK,CAAC,CAAC;UAAE;UAC5BT,KAAK,EAAEA,CAAA,KAAM,CAAC,CAAC,CAAC;QAClB;MACF,CAAC;;MAED,SAASM,OAAOA,CAAA,EAAG;QAC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ACH,CAAC;AAAAE,OAAA,CAAAnC,OAAA,GAAAC,QAAA"}
1
+ {"version":3,"file":"index.js","names":["_deepEql","_interopRequireDefault","require","obj","__esModule","default","_default","options","DEFAULT_OPTIONS","queryPattern","results","connection","close","break","execute","query","args","rows","getRows","resultSet","getRow","shift","index","findIndex","expectedArgs","test","undefined","deepEqual","splice","getConnection","createPool","_clear","Object","keys","forEach","k","_execute","optList","opts","push","exports"],"sources":["../src/index.js"],"sourcesContent":["/**\n*\n* @licstart The following is the entire license notice for the JavaScript code in this file.\n*\n* A mock for oracledb Node.js module\n*\n* Copyright (C) 2020 University Of Helsinki (The National Library Of Finland)\n*\n* This file is part of oracledb-mock-js\n*\n* oracledb-mock-js program is free software: you can redistribute it and/or modify\n* it under the terms of the GNU Affero 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* oracledb-mock-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 Affero General Public License for more details.\n*\n* You should have received a copy of the GNU Affero 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 deepEqual from 'deep-eql';\n\nexport default () => {\n const options = [];\n const DEFAULT_OPTIONS = {\n queryPattern: /.*/u,\n results: []\n };\n\n const connection = {\n close: () => {}, // eslint-disable-line no-empty-function\n break: () => {}, // eslint-disable-line no-empty-function\n execute: (query, args) => {\n const rows = getRows();\n\n return {\n resultSet: {\n getRow: () => rows.shift(), // eslint-disable-line functional/immutable-data\n close: () => {} // eslint-disable-line no-empty-function\n }\n };\n\n function getRows() {\n const index = options.findIndex(({queryPattern, expectedArgs}) => {\n if (queryPattern.test(query) && (expectedArgs === undefined || deepEqual(args, expectedArgs))) {\n return true;\n }\n\n return false;\n });\n\n if (index >= 0) {\n const {results} = options.splice(index, 1).shift(); // eslint-disable-line functional/immutable-data\n return results;\n }\n\n return [];\n }\n }\n };\n\n return {\n getConnection: () => connection,\n createPool: () => ({\n getConnection: () => connection,\n close: () => {} // eslint-disable-line no-empty-function\n }),\n _clear: () => {\n // Clear array\n options.splice(0); // eslint-disable-line functional/immutable-data\n Object.keys(options).forEach(k => delete options[k]); // eslint-disable-line functional/immutable-data\n },\n _execute: optList => {\n // Clear array\n options.splice(0); // eslint-disable-line functional/immutable-data\n\n optList.forEach(opts => {\n options.push({...DEFAULT_OPTIONS, ...opts}); // eslint-disable-line functional/immutable-data\n });\n }\n };\n};\n"],"mappings":";;;;;;AA4BA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AA5BjC;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;AA1BA,IAAAG,QAAA,GA8BeA,CAAA,KAAM;EACnB,MAAMC,OAAO,GAAG,EAAE;EAClB,MAAMC,eAAe,GAAG;IACtBC,YAAY,EAAE,KAAK;IACnBC,OAAO,EAAE;EACX,CAAC;EAED,MAAMC,UAAU,GAAG;IACjBC,KAAK,EAAEA,CAAA,KAAM,CAAC,CAAC;IAAE;IACjBC,KAAK,EAAEA,CAAA,KAAM,CAAC,CAAC;IAAE;IACjBC,OAAO,EAAEA,CAACC,KAAK,EAAEC,IAAI,KAAK;MACxB,MAAMC,IAAI,GAAGC,OAAO,CAAC,CAAC;MAEtB,OAAO;QACLC,SAAS,EAAE;UACTC,MAAM,EAAEA,CAAA,KAAMH,IAAI,CAACI,KAAK,CAAC,CAAC;UAAE;UAC5BT,KAAK,EAAEA,CAAA,KAAM,CAAC,CAAC,CAAC;QAClB;MACF,CAAC;MAED,SAASM,OAAOA,C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ACF,CAAC;AACH,CAAC;AAAAE,OAAA,CAAAnC,OAAA,GAAAC,QAAA"}
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "url": "git@github.com:natlibfi/oracledb-mock-js.git"
15
15
  },
16
16
  "license": "LGPL-3.0+",
17
- "version": "1.0.2-alpha.1",
17
+ "version": "1.0.2",
18
18
  "main": "./dist/index.js",
19
19
  "engines": {
20
20
  "node": ">=12"
@@ -24,34 +24,35 @@
24
24
  },
25
25
  "scripts": {
26
26
  "prepare": "npm run build",
27
- "lint": "eslint src",
28
- "lint:dev": "eslint --fix src",
29
- "test:base": "cross-env NODE_ENV=test nyc mocha --require @babel/register",
30
- "test": "npm run lint && npm run test:base -- src/*.spec.js && npm run coverage",
31
- "test:dev": "npm run lint:dev && npm run test:base -- src/*.spec.js && npm run coverage",
32
- "coverage": "nyc check-coverage --per-file",
33
27
  "build": "babel src --source-maps --copy-files --delete-dir-on-start --out-dir=dist",
34
- "watch:test": "cross-env DEBUG=1 NODE_ENV=test nodemon -w src -w test-fixtures --exec 'npm run test:dev'"
28
+ "lint": "eslint ./src",
29
+ "lint:dev": "eslint --fix ./src",
30
+ "test": "npm run lint && npm run test:base",
31
+ "test:base": "cross-env NODE_ENV=test nyc mocha --package ./package.json",
32
+ "test:dev": "npm run lint:dev && npm run test:base",
33
+ "coverage": "nyc check-coverage --per-file",
34
+ "dev": "nodemon",
35
+ "dev:debug": "cross-env LOG_LEVEL=debug DEBUG=@natlibfi/* NODE_ENV=test nodemon",
36
+ "watch:test": "cross-env DEBUG=@natlibfi/* NODE_ENV=test nodemon -w src -w test-fixtures --exec 'npm run test:dev'"
35
37
  },
36
38
  "dependencies": {
37
- "deep-eql": "^4.0.0"
39
+ "deep-eql": "^4.1.3"
38
40
  },
39
41
  "devDependencies": {
40
- "@babel/cli": "^7.22.9",
41
- "@babel/core": "^7.22.9",
42
- "@babel/eslint-parser": "^7.22.9",
43
- "@babel/node": "^7.22.6",
44
- "@babel/preset-env": "^7.22.9",
45
- "@babel/register": "^7.22.5",
46
- "@natlibfi/eslint-config-melinda-backend": "^3.0.0",
47
- "@natlibfi/fixugen": "^2.0.0",
48
- "@natlibfi/fixura": "^3.0.0",
49
- "babel-plugin-istanbul": "^6.0.0",
50
- "chai": "^4.2.0",
51
- "cross-env": "^7.0.2",
52
- "eslint": "^8.45.0",
42
+ "@babel/cli": "^7.23.4",
43
+ "@babel/core": "^7.23.6",
44
+ "@babel/node": "^7.22.19",
45
+ "@babel/preset-env": "^7.23.6",
46
+ "@babel/register": "^7.22.15",
47
+ "@natlibfi/eslint-config-melinda-backend": "^3.0.3",
48
+ "@natlibfi/fixugen": "^2.0.3",
49
+ "@natlibfi/fixura": "^3.0.3",
50
+ "babel-plugin-istanbul": "^6.1.1",
51
+ "chai": "^4.3.10",
52
+ "cross-env": "^7.0.3",
53
+ "eslint": "^8.56.0",
53
54
  "mocha": "^10.2.0",
54
- "nodemon": "^3.0.1",
55
+ "nodemon": "^3.0.2",
55
56
  "nyc": "^15.1.0"
56
57
  },
57
58
  "eslintConfig": {
@@ -74,16 +75,34 @@
74
75
  }
75
76
  }
76
77
  },
78
+ "mocha": {
79
+ "spec": [
80
+ "src/*.spec.js",
81
+ "src/**/*.spec.js"
82
+ ],
83
+ "require": [
84
+ "@babel/register"
85
+ ],
86
+ "inline-diffs": true,
87
+ "maxDiffSize": 25000,
88
+ "bail": true,
89
+ "exit": true
90
+ },
91
+ "nodemonConfig": {
92
+ "exec": "npm run test:dev",
93
+ "watch": [
94
+ "src/*",
95
+ "test-fixtures/*"
96
+ ]
97
+ },
77
98
  "nyc": {
78
99
  "exclude": [
79
- "*/*.spec.js"
100
+ "src/*.spec.js",
101
+ "src/**/*.spec.js"
80
102
  ],
81
103
  "reporter": [
82
104
  "text"
83
105
  ],
84
- "require": [
85
- "@babel/register"
86
- ],
87
106
  "sourceMap": false,
88
107
  "instrument": false,
89
108
  "lines": 80,