{"id":18614882,"url":"https://github.com/andrewjbateman/nodejs-app-testing","last_synced_at":"2025-08-01T08:38:49.993Z","repository":{"id":96860802,"uuid":"319714695","full_name":"AndrewJBateman/nodejs-app-testing","owner":"AndrewJBateman","description":":clipboard: Testing of Node.js applications","archived":false,"fork":false,"pushed_at":"2021-06-19T10:14:58.000Z","size":98,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-27T02:44:50.334Z","etag":null,"topics":["assertion-library","chai-assertion","unfinished"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndrewJBateman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-08T17:41:15.000Z","updated_at":"2021-06-19T10:15:00.000Z","dependencies_parsed_at":"2023-03-30T11:36:49.526Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/nodejs-app-testing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-app-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-app-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-app-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnodejs-app-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/nodejs-app-testing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239406449,"owners_count":19633024,"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":["assertion-library","chai-assertion","unfinished"],"created_at":"2024-11-07T03:27:17.897Z","updated_at":"2025-02-18T03:44:41.716Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :zap: Node.js App Testing\n\n* Code to practise testing of Node.js apps\n* This is Section 30 of a [Udemy NodeJS - The Complete Guide (incl. MVC, REST APIs, GraphQL)](https://www.udemy.com/nodejs-the-complete-guide/)\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/nodejs-app-testing?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/nodejs-app-testing?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/nodejs-app-testing?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/nodejs-app-testing?style=plastic)\n\n## :page_facing_up: Table of contents\n\n* [:zap: Node.js App Testing](#zap-nodejs-app-testing)\n  * [:page_facing_up: Table of contents](#page_facing_up-table-of-contents)\n  * [:books: General info](#books-general-info)\n  * [:camera: Screenshots](#camera-screenshots)\n  * [:signal_strength: Technologies](#signal_strength-technologies)\n  * [:floppy_disk: Setup](#floppy_disk-setup)\n  * [:computer: Code Examples](#computer-code-examples)\n  * [:cool: Features](#cool-features)\n  * [:clipboard: App Status \u0026 To-do list](#clipboard-app-status--to-do-list)\n  * [:clap: Inspiration](#clap-inspiration)\n  * [:envelope: Contact](#envelope-contact)\n\n## :books: General info\n\n* Uses Chai assertion library and Mocha test framework to test Node.js code\n\n## :camera: Screenshots\n\n* No screenshots this time :-)\n\n## :signal_strength: Technologies\n\n* [Node.js v14](https://nodejs.org)\n* [Express v4](https://www.npmjs.com/package/express) middleware for Node.js\n* [Mocha v9](https://mochajs.org/) JavaScript test framework running on Node.js and in the browser\n* [Chai v4](https://www.chaijs.com/) assertion library for Node.js and the browser\n* [Sinon v11](https://www.npmjs.com/package/sinon) standalone and test framework agnostic JavaScript test spies, stubs and mocks\n\n## :floppy_disk: Setup\n\n* Run `npm i` to install dependencies\n* Create a .env file and add MongoDB `ATLAS_URI` to .env file\n* Run `npm run test` to run tests\n\n## :computer: Code Examples\n\n* extract from `test/auth-middleware.js` showing a Mocha test with Chai assertion\n\n```javascript\nit('should throw an error if no auth header is present', function () {\n  const req = {\n    get: function (headerName) {\n      return null;\n    },\n  };\n    expect(authMiddleware.bind(this, req, {}, () =\u003e {})).to.throw(\n      'Not authenticated.'\n    );\n  });\n```\n\n## :cool: Features\n\n* Chai assertion tests are easy to understand\n\n## :clipboard: App Status \u0026 To-do list\n\n* Status: Working tests\n* To-Do:  Try out new tests\n\n## :clap: Inspiration\n\n* [NodeJS - The Complete Guide (incl. MVC, REST APIs, GraphQL)](https://www.udemy.com/nodejs-the-complete-guide/)\n* [Chai Assertion Library Test Suite](https://www.chaijs.com/api/test/)\n\n## :file_folder: License\n\n* N/A.\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnodejs-app-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fnodejs-app-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnodejs-app-testing/lists"}