{"id":22173686,"url":"https://github.com/stefruseva88/qunit-func-tests","last_synced_at":"2025-10-12T19:30:50.325Z","repository":{"id":248683925,"uuid":"829401866","full_name":"StefRuseva88/qUnit-func-tests","owner":"StefRuseva88","description":"qUnit functions and tests","archived":true,"fork":false,"pushed_at":"2024-11-29T15:16:48.000Z","size":96,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T17:53:35.320Z","etag":null,"topics":["async-await","javascript","qunit-tests"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StefRuseva88.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-07-16T11:02:24.000Z","updated_at":"2025-02-06T17:34:28.000Z","dependencies_parsed_at":"2024-08-03T08:48:18.857Z","dependency_job_id":"076c067e-bedf-4139-97a5-26c35384cd61","html_url":"https://github.com/StefRuseva88/qUnit-func-tests","commit_stats":null,"previous_names":["stefruseva88/qunit-func-tests"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/StefRuseva88/qUnit-func-tests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefRuseva88%2FqUnit-func-tests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefRuseva88%2FqUnit-func-tests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefRuseva88%2FqUnit-func-tests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefRuseva88%2FqUnit-func-tests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StefRuseva88","download_url":"https://codeload.github.com/StefRuseva88/qUnit-func-tests/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefRuseva88%2FqUnit-func-tests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279012668,"owners_count":26085159,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"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":["async-await","javascript","qunit-tests"],"created_at":"2024-12-02T07:34:43.073Z","updated_at":"2025-10-12T19:30:50.007Z","avatar_url":"https://github.com/StefRuseva88.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# qUnit functions and tests\n\n[![JavaScript](https://img.shields.io/badge/Made%20with-JavaScript-F7DF1E.svg)](https://developer.mozilla.org/en-US/docs/Web/JavaScript)\n[![QUnit](https://img.shields.io/badge/tested%20with-QUnit-9C4CB4.svg)](https://qunitjs.com/)\n\n### This is a test project for **Front-End Technologies** May 2024 Course @ SoftUni\n---\n   \n### Functions\n\n- **Sum Function**: Adds two numbers and returns their sum.\n- **isEven Function**: Determines if a given number is even and returns true or false.\n- **Factorial Function**: Computes the factorial of a number recursively.\n- **isPalindrome Function**: Verifies whether a string is a palindrome.\n- **Fibonacci Function**: Generates the Fibonacci sequence up to a given number of terms.\n- **nthPrime Function**: Returns the nth prime number.\n- **pascalsTriangle Function**: Produces Pascal's Triangle up to a specified number of rows.\n- **isPerfectSquare Function**: Checks whether a number is a perfect square.\n- **fetchData Function**: Makes an API call to retrieve data from a specified URL and returns the response.\n- **fakeDelay Function**: Simulates a delay by returning a promise that resolves after a specified number of milliseconds.\n  \n## Install QUnit\nTo write tests we will install QUnit.\n\n### Steps\n1. Open the Terminal in VS Code from `View` -\u003e `Terminal`.\n2. Write the command `npm init -y`.\n3. After running the command, you should see the `package.json` file in the EXPLORER.\n4. Install QUnit through npm by executing the command `npm install --save-dev qunit`.\n\n### Write Tests\n1. Create a QUnit module in `sum_tests.js`:\n    ```javascript\n    QUnit.module('Sum Function Tests', () =\u003e {\n        QUnit.test('Sum of two positive numbers', assert =\u003e {\n            assert.equal(sum(2, 3), 5, '2 + 3 should be 5');\n        });\n    });\n    ```\n\n2. Run the tests by modifying the test script in `package.json` to use QUnit:\n    ```javascript\n   \"scripts\": {\n    \"test\": \"qunit\"\n    }\n    ```\n## Tests for All Functions\n1. **Sum Function** Tests:\n- Test 1: Validate the sum of two positive numbers.\n- Test 2: Check for the sum of a positive and a negative number.\n- Test 3: Ensure the sum of two negative numbers works correctly.\n- Test 4: Handle edge cases, such as summing zero with another number.\n2. **isEven Function** Tests\n- Test 1: Verify if an even number returns `true`.\n- Test 2: Confirm that an odd number returns `false`.\n- Test 3: Check boundary values like 0 and negative even/odd numbers.\n3. **Factorial Function** Tests\n- Test 1: Compute the factorial of a positive integer (e.g., 5!).\n- Test 2: Ensure that the factorial of 0 returns 1.\n- Test 3: Test for large numbers to evaluate function performance and accuracy.\n4. **isPalindrome Function** Tests\n- Test 1: Confirm that a valid palindrome string (e.g., \"racecar\") returns true.\n- Test 2: Check for non-palindrome strings.\n- Test 3: Ensure the function is case-insensitive and handles punctuation.\n5. **Fibonacci Function** Tests\n- Test 1: Generate the first 5 terms of the Fibonacci sequence.\n- Test 2: Test edge cases like generating 1 or 0 terms.\n- Test 3: Check if the function handles large inputs efficiently.\n6. **nthPrime Function** Tests\n- Test 1: Return the 5th prime number (which should be 11).\n- Test 2: Handle boundary cases like the 1st prime number.\n- Test 3: Check performance for larger prime numbers.\n7. **pascalsTriangle Function** Tests\n- Test 1: Generate Pascal’s Triangle for 5 rows and check the structure.\n- Test 2: Ensure that invalid inputs (e.g., negative numbers) are handled gracefully.\n- Test 3: Test the function for a single row.\n8. **isPerfectSquare Function** Tests\n- Test 1: Verify that perfect squares (e.g., 16) return true.\n- Test 2: Ensure non-perfect square numbers return false.\n- Test 3: Handle edge cases like 0 and 1, which are both perfect squares.\n9. **fetchData Function** Tests\n- Test 1: Validate the response from the API endpoint. Check that all keys and values match the expected output, including the properties inside the \"places\" array.\n- Test 2: Test for a non-existent postcode and ensure that the response is undefined.\n- Test 3: Handle an incorrect URL and check that an error or undefined is returned.\n10. **fakeDelay Function** Tests\n- Test 1: Ensure that the promise resolves after a 1000-millisecond delay. Use an assertion to verify the correct execution time.\n- Test 2: Test for various delay times (e.g., 500ms, 2000ms) to verify the function handles different intervals.\n- Test 3: Check for invalid inputs (e.g., negative numbers or non-numeric values) and confirm that the function returns an appropriate error or behavior.\n\n## License\nThis project is licensed under the [MIT License](LICENSE). See the [LICENSE](LICENSE) file for details.\n\n## Contact\nFor any questions or suggestions, please open an issue in the repository.\n\n--- \n### Happy Testing! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefruseva88%2Fqunit-func-tests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefruseva88%2Fqunit-func-tests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefruseva88%2Fqunit-func-tests/lists"}