{"id":21198703,"url":"https://github.com/natlibfi/oracledb-mock-js","last_synced_at":"2026-03-05T12:04:44.600Z","repository":{"id":143773311,"uuid":"274308624","full_name":"NatLibFi/oracledb-mock-js","owner":"NatLibFi","description":"A mock for oracledb Node.js module","archived":false,"fork":false,"pushed_at":"2023-12-22T10:12:22.000Z","size":460,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-07-01T20:03:28.749Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NatLibFi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-23T04:29:49.000Z","updated_at":"2023-12-21T11:40:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"446ec7c0-dfdc-49f0-b050-dfeeb564bcb9","html_url":"https://github.com/NatLibFi/oracledb-mock-js","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/NatLibFi/oracledb-mock-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLibFi%2Foracledb-mock-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLibFi%2Foracledb-mock-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLibFi%2Foracledb-mock-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLibFi%2Foracledb-mock-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NatLibFi","download_url":"https://codeload.github.com/NatLibFi/oracledb-mock-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NatLibFi%2Foracledb-mock-js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264538580,"owners_count":23624436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-20T19:53:03.403Z","updated_at":"2026-03-05T12:04:44.556Z","avatar_url":"https://github.com/NatLibFi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A mock for oracledb Node.js module [![NPM Version](https://img.shields.io/npm/v/@natlibfi/oracledb-mock.svg)](https://npmjs.org/package/@natlibfi/oracledb-mock)\n\n# Usage\n```js\nimport createMock from '@natlibfi/oracledb-mock';\n\nconst oracledb = createMock();\n\noracledbMock._execute([\n  {\n    queryPattern: /^SELECT * from foobar$/,\n    results: [\n      { foo: 'bar' }\n    ]\n  }\n]);\n\nawait operate(oracledbMock);\n\noracledbMock._clear();\n\nasync function operate(oracledb) {\n  const connection = await oracledb.getConnection();\n  const {resultSet} = await connection.execute('SELECT * from foobar');\n  const row = await resultSet.getRow();\n  // do something with `{foo: 'bar'}`\n  return connection.close();  \n}\n```\n## Mocking queries\nThe `_execute` method initializes the mock with expected queries and their results. An array of object is passed to the `_execute` method and the array is iterated for matching results. The following parameters are supported\n- **queryPattern**: A `RegExp` object which the query is tested against. Defaults to `.*`.\n- **expectedArgs**: An optional object which, if present, must be equal to the arguments passed to the execute-call of the connection.\n- **results**: An array of results represented as object (Column names are the properties).\n\n## License and copyright\n\nCopyright (c) 2020 **University Of Helsinki (The National Library Of Finland)**\n\nThis project's source code is licensed under the terms of **GNU Lesser General Public License Version 3** or any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatlibfi%2Foracledb-mock-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatlibfi%2Foracledb-mock-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatlibfi%2Foracledb-mock-js/lists"}