{"id":26884816,"url":"https://github.com/zafir100100/angular-component-testing-with-jasmine-and-karma","last_synced_at":"2026-05-09T04:33:42.901Z","repository":{"id":284936266,"uuid":"956520389","full_name":"zafir100100/Angular-Component-Testing-with-Jasmine-and-Karma","owner":"zafir100100","description":"This repository contains unit tests for the LoginComponent in an Angular application. It ensures the login form behaves correctly, with validation rules and maximum length constraints.","archived":false,"fork":false,"pushed_at":"2025-03-31T07:51:36.000Z","size":141,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T08:31:35.104Z","etag":null,"topics":["angular","component-testing","jasmine","karma"],"latest_commit_sha":null,"homepage":"","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/zafir100100.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":"2025-03-28T11:47:41.000Z","updated_at":"2025-03-31T07:52:08.000Z","dependencies_parsed_at":"2025-03-31T08:31:36.160Z","dependency_job_id":null,"html_url":"https://github.com/zafir100100/Angular-Component-Testing-with-Jasmine-and-Karma","commit_stats":null,"previous_names":["zafir100100/e2e-angular-component-testing-with-jasmine-karma","zafir100100/angular-component-testing-with-jasmine-and-karma"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zafir100100%2FAngular-Component-Testing-with-Jasmine-and-Karma","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zafir100100%2FAngular-Component-Testing-with-Jasmine-and-Karma/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zafir100100%2FAngular-Component-Testing-with-Jasmine-and-Karma/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zafir100100%2FAngular-Component-Testing-with-Jasmine-and-Karma/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zafir100100","download_url":"https://codeload.github.com/zafir100100/Angular-Component-Testing-with-Jasmine-and-Karma/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246517353,"owners_count":20790405,"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":["angular","component-testing","jasmine","karma"],"created_at":"2025-03-31T18:29:04.422Z","updated_at":"2026-04-10T16:45:27.832Z","avatar_url":"https://github.com/zafir100100.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular Component Testing with Jasmine \u0026 Karma\n\nThis repository contains unit tests for the `LoginComponent` in an Angular application. It ensures the login form behaves correctly, with validation rules and maximum length constraints.  \n\n## **Video**  \n\nhttps://github.com/user-attachments/assets/1e88049b-e069-43d0-b27f-3e84d25a5e64\n\n## **Technologies Used**  \n- Angular (version 19)\n- Jasmine \u0026 Karma (for testing)  \n- SweetAlert2 (for modal handling)  \n\n## **Test Scenarios**  \n\n### ✅ **Component Initialization**  \n- Should create the `LoginComponent`.  \n\n### ✅ **Form Controls**  \n- Should create a form with `username` and `password` fields.  \n- Should make the `username` and `password` fields **required**.  \n- Should mark the form as **invalid** when fields are empty.  \n- Should mark the form as **valid** when required fields are filled.  \n\n### ✅ **Form Validation Rules**  \n- Should make the `username` invalid if it **exceeds max length**.  \n- Should make the `password` invalid if it **exceeds max length**.  \n- Should make the `username` valid if it's **within max length**.  \n- Should make the `password` valid if it's **within max length**.  \n\n### ✅ **Login Functionality**  \n- Should return **true** when login is successful.  \n- Should return **false** when login fails with incorrect credentials.  \n\n### ✅ **SweetAlert2 Modal Handling**  \n- Should **dismiss SweetAlert modal after each test** by simulating `Esc` key or calling `Swal.close()`.  \n\n## **Setup \u0026 Run Tests**  \n\n### 📌 **Installation**  \n```bash\ngit clone https://github.com/your-username/angular-login-testing.git\ncd angular-login-testing\nnpm install\n```\n\n### 📌 **Run Application**  \n```bash\nng s\n```\n\n### 📌 **Run Test**  \n```bash\nng test\n```\n\n## Screenshot (Application)\n\n![image](https://github.com/user-attachments/assets/46c0da3b-f972-423b-995c-bce69c0dda1a)\n\n## Screenshot (Test Report)\n\n![image](https://github.com/user-attachments/assets/6545d43f-9ed6-46f3-b064-40582663f6f3)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzafir100100%2Fangular-component-testing-with-jasmine-and-karma","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzafir100100%2Fangular-component-testing-with-jasmine-and-karma","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzafir100100%2Fangular-component-testing-with-jasmine-and-karma/lists"}