{"id":28366687,"url":"https://github.com/dsomleff/ibm-tdd-badge","last_synced_at":"2026-05-14T21:32:54.102Z","repository":{"id":94547200,"uuid":"355171249","full_name":"dsomleff/ibm-tdd-badge","owner":"dsomleff","description":"JS TDD Katas","archived":false,"fork":false,"pushed_at":"2021-04-06T12:36:27.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-21T22:33:20.838Z","etag":null,"topics":["javascript","jest","jest-tests","js","tdd","tdd-javascript","tdd-kata"],"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/dsomleff.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-06T11:55:55.000Z","updated_at":"2021-04-06T12:36:29.000Z","dependencies_parsed_at":"2023-04-29T17:19:34.919Z","dependency_job_id":null,"html_url":"https://github.com/dsomleff/ibm-tdd-badge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dsomleff/ibm-tdd-badge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsomleff%2Fibm-tdd-badge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsomleff%2Fibm-tdd-badge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsomleff%2Fibm-tdd-badge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsomleff%2Fibm-tdd-badge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsomleff","download_url":"https://codeload.github.com/dsomleff/ibm-tdd-badge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsomleff%2Fibm-tdd-badge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33044098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javascript","jest","jest-tests","js","tdd","tdd-javascript","tdd-kata"],"created_at":"2025-05-29T00:10:45.160Z","updated_at":"2026-05-14T21:32:54.097Z","avatar_url":"https://github.com/dsomleff.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloud Garage TDD\nSummary of tasks for obtaining the [Test-Driven Development](https://www.ibm.com/cloud/architecture/content/course/test-driven-development) badge.\nThis repo contains solutions for katas represented in course.\n\n![alt text](https://www.ibm.com/cloud/architecture/images/badges/test-driven-development.png)\n\nDown below is  text from origin repo for course.\n\n# Set up project\n\n0. Clone this git repository\n    * In your profile \u003e settings \u003e SSH Keys confirm you have set up an SSH Key for Github. If not, then set up SSH access to github. [Connecting to GitHub with SSH](https://help.github.com/enterprise/2.6/user/articles/connecting-to-github-with-ssh/)\n\n1. Install Node.js (v8.1.4 or above)\n\t* Mac/Linux: Install nvm from https://github.com/creationix/nvm, then run `nvm use` from your terminal\n\t* Windows: Download and install Node.js from https://nodejs.org/en/download/\n\n2. From your terminal, run `npm init -y`\n\n# Install Jest\n\n**Jest** is a JavaScript test framework that we can use for testing both front-end and back-end code.\n\nOne of Jest's philosophies is to provide an integrated \"zero-configuration\" experience for writing tests.\nConveniently, this means that it includes everything you need for TDD in a single package (test runner, assertions,\nmatchers, spies, stubs and mocks)\n\nThe jest documentation can be found here: https://jestjs.io/docs/en/getting-started\n\n1. Install jest with `npm install --save-dev jest`\n\n2. Modify your `package.json` file, replacing:\n\n    ```\n    \"scripts\": {\n        \"test\": \"echo \\\"Error: no test specified\\\" \u0026\u0026 exit 1\"\n    },\n    ```\n\n    with\n\n    ```\n    \"scripts\": {\n        \"test\": \"jest --verbose\",\n        \"tdd\": \"jest --verbose --watch --onlyChanged\"\n    },\n    ```\n\n3. Run `npm test`\n\n    This command runs all tests and exits. Typically, we will call this from within the build pipeline.\n\n4. Run `npm run tdd`\n\n    This command continuously watches files for changes and rerun tests related to changed files.\n    This is the command we will be using most often during TDD.\n\n\n# Configure pre-commit hooks [Optional]\n\nTo prevent bad commits, we can configure pre-commit hooks to ensure that unit tests are run before every commit.\n\n1. Install husky with `npm install --save-dev husky`\n\n2. Modify your `package.json` file, replacing:\n\n    ```\n    \"scripts\": {\n        \"test\": \"jest --verbose\",\n        \"tdd\": \"jest --verbose --watch --onlyChanged\"\n    },\n\n    ```\n\n    with\n\n    ```\n    \"scripts\": {\n        \"test\": \"jest --verbose\",\n        \"tdd\": \"jest --verbose --watch --onlyChanged\",\n        \"precommit\": \"npm test\"\n    },\n\n    ```\n\n# Configure your IDE [Optional]\n\n## IntelliJ\n\nIn Preferences:\n\n1. Under Language \u0026 Frameworks \u003e JavaScript, set your JavaScript language version to \"ECMAScript 6\".\n\n2. Under Language \u0026 Frameworks \u003e JavaScript \u003e Libraries, download and enable both `jest` and `node`.\n\n\n# Explore the canary test\n\nOpen up `server/00-canary/canary.spec.js`, and note that:\n\n1. For jest to find your tests, you need to place your tests in a `__tests__` folder,\n   or name your test files with a `.spec.js` or `.test.js` extension.\n\n2. `describe` creates a block that groups together several related tests in one \"test suite\".\n\n   You can also nest `describe` blocks if you have a hierarchy of tests.\n\n3. `it` takes two arguments. The first argument describes the test; the second argument is a function\n   that contains the expectations to test.\n\n4. When you're writing tests, you often need to check that values meet certain conditions.\n   `expect` gives you access to a number of \"matchers\" that let you validate different things.\n\n   A good introduction to the available matchers can be found here: https://facebook.github.io/jest/docs/en/using-matchers.html\n\n5. Together, the descriptions that we use in the `describe` and `it` blocks are shown in the test output.\n   The aim is to structure and name our tests in such a way that the test output reads like a \"requirements spec\".\n\n\n# Let's get started!\n\nNow that you're all set, let's get started with the TDD exercises.\n\nAs you go through the TDD exercises, keep in mind the **Four Rules of Simple Design**,\nand the **Transformation Priority Premise**.\n\n\n## [The Four Rules of Simple Design](https://martinfowler.com/bliki/BeckDesignRules.html):\n\n* **_Passes the tests_**\n* **_Reveals intention_**\n* **_No duplication_**\n* **_Fewest elements_**\n\n\n## [The Transformation Priority Premise](https://8thlight.com/blog/uncle-bob/2013/05/27/TheTransformationPriorityPremise.html):\n\n```\n(01) [{} –\u003e nil] no code =\u003e return nil\n\n(02) [nil-\u003econstant] nil =\u003e simple constant\n\n(03) [constant-\u003econstant+] simple constant =\u003e complex constant\n\n(04) [constant-\u003escalar] complex constant =\u003e variable or an argument\n\n(05) [statement-\u003estatements] adding more unconditional statements.\n\n(06) [unconditional-\u003eif] splitting the execution path\n\n(07) [scalar-\u003earray]\n\n(08) [array-\u003econtainer]\n\n(09) [statement-\u003erecursion]\n\n(10) [if-\u003ewhile]\n\n(11) [expression-\u003efunction] replacing an expression with a function or algorithm\n\n(12) [variable-\u003eassignment] replacing the value of a variable.\n```\n\n\n## [Simplified Transformation Priority Premise](https://8thlight.com/blog/micah-martin/2012/11/17/transformation-priority-premise-applied.html):\n\n```\n(01) constant =\u003e a value\n\n(02) scalar =\u003e a local binding, or variable\n\n(03) invocation =\u003e calling a function/method\n\n(04) conditional =\u003e if/switch/case/cond\n\n(05) while loop =\u003e applies to for loops as well\n\n(06) assignment =\u003e replacing the value of a variable\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsomleff%2Fibm-tdd-badge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsomleff%2Fibm-tdd-badge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsomleff%2Fibm-tdd-badge/lists"}