{"id":22080730,"url":"https://github.com/niraj-khatiwada/node-jest","last_synced_at":"2025-06-16T00:09:03.731Z","repository":{"id":203094732,"uuid":"706549784","full_name":"niraj-khatiwada/node-jest","owner":"niraj-khatiwada","description":"Testing in Node.js using Jest","archived":false,"fork":false,"pushed_at":"2023-10-25T15:19:52.000Z","size":116,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T20:45:47.821Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/niraj-khatiwada.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":"2023-10-18T07:07:02.000Z","updated_at":"2023-10-23T15:59:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"4e43552f-6556-4a3e-863f-55108eb7d1a3","html_url":"https://github.com/niraj-khatiwada/node-jest","commit_stats":null,"previous_names":["niraj-khatiwada/node-jest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/niraj-khatiwada/node-jest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niraj-khatiwada%2Fnode-jest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niraj-khatiwada%2Fnode-jest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niraj-khatiwada%2Fnode-jest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niraj-khatiwada%2Fnode-jest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niraj-khatiwada","download_url":"https://codeload.github.com/niraj-khatiwada/node-jest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niraj-khatiwada%2Fnode-jest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260072758,"owners_count":22954922,"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-30T23:16:39.647Z","updated_at":"2025-06-16T00:09:03.705Z","avatar_url":"https://github.com/niraj-khatiwada.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AAA principle:\n\n- arrange\n- act\n- assert\n\n# Test Doubles\n\n### Stubs:\n\n- In stubs, you expect a pre-defined output. for eg: success, failure, exception, etc.\n- Is the return type correct based on the parameters passed?\n\n### Fakes:\n\n- Fakes are the closest thing that a testing environment when compared to real feature\n- For eg: If you want to connect to Google services, instead of connecting to Google in tests, you create a fake http server that mimics as Google server.\n- Or you create a fake database implementation that mimics the actual database. Maybe use a in memory SQLite database as fake db.\n- Fakes causes limitation where even if you provide very simple implementation not covering all aspect of tests, the test coverage might say 100%. That is solved by mocks.\n\n### Mocks:\n\n- When you want to mock the implementation of a function or a method\n- Was the function called correctly? How many times it was called?\n- Are the parameters correct?\n- Mocks usually do not test the return values. Those are done using stubs.\n\n### Spies:\n\n- Similar to mocks but usually used to mock the methods of an object\n\n# TDD: Test Driven Development\n\n- Chicago vs London\n\n### Chicago\n\n- A unit = collection of pieces working together to make a feature.\n- Tests from a broader view\n- Little use of mocks\n\n### London\n\n- A unit = a class\n- heavy usage of mocks. Mocks all of the dependencies\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniraj-khatiwada%2Fnode-jest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniraj-khatiwada%2Fnode-jest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniraj-khatiwada%2Fnode-jest/lists"}