An open API service indexing awesome lists of open source software.

https://github.com/actionanand/ng-dev-testing

Complete Angular Testing Repo - A complete guide to Angular Unit Testing
https://github.com/actionanand/ng-dev-testing

angular angular-testing angular11 unittest

Last synced: about 2 months ago
JSON representation

Complete Angular Testing Repo - A complete guide to Angular Unit Testing

Awesome Lists containing this project

README

        

# Ng Dev Testing

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.8.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.

## Code scaffolding

Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.

## Build

Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.

## Running unit tests

Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Running end-to-end tests

Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

## Deploy to GitHub Pages

1. To begin, add the `angular-cli-ghpages` builder.

```bash
ng add angular-cli-ghpages
```

2. If you’re deploying the project to a Github project page you’ll need to set the `baseHref` property as the repository name. The `baseHref` will be used for all relative URLs on your site. You could specify the `baseHref` as part of the project architect deploy options in the `angular.json` file. Or just pass it as the `--base-href` flag to the `ng deploy` command. If you’re deploying the project to a Github user page, you do not need to set this option.

```bash
ng deploy --base-href=//
```

GitHub will automatically enable Pages when you push a gh-pages branch. There is no need to enable Pages from the repository settings.

```bash
ng deploy --base-href=/ng-dev-testing/
```

* [Source](https://blog.bitsrc.io/deploy-your-angular-project-to-github-pages-7cbacb96f35b)
* [How to deploy a React, Angular and Vue project to Github pages](https://deepinder.me/how-to-deploy-a-react-angular-vue-project-to-github-pages)
* [Mocking Route params in Angular unit tests](https://www.joshuacolvin.net/mocking-activated-route-data-in-angular/)
* [Testing Angular routing components with the RouterTestingModule](https://dev.to/this-is-angular/testing-angular-routing-components-with-the-routertestingmodule-4cj0)
* [Writing Angular Test Cases for Router, Service, ActivatedRoute](https://medium.com/@akankshasingh872/writing-angular-test-cases-for-router-service-activatedroute-f28df460487a)
* [Mock ActivatedRoute with params, data and snapshot](https://gist.github.com/benjamincharity/3d25cd2c95b6ecffadb18c3d4dbbd80b)
* [An Introduction to Jasmine Unit Testing](https://www.freecodecamp.org/news/jasmine-unit-testing-tutorial-4e757c2cbf42/)
* [Overriding Components for Testing](https://angular-training-guide.rangle.io/testing/components/injecting-dependencies/overriding)

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.