diff --git a/README.md b/README.md index b55b6f186..f898a3d48 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ This goal of this project is to help you get better at Angular and NgRx by resol
testing -router Testing +router outlet Testing ## Contributors ✨ diff --git a/apps/router-testing/cypress/support/component-index.html b/apps/router-testing/cypress/support/component-index.html deleted file mode 100644 index 0dd8fb9e2..000000000 --- a/apps/router-testing/cypress/support/component-index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - router-testing Components App - - - -
- - diff --git a/apps/router-testing/.eslintrc.json b/apps/testing-router-outlet/.eslintrc.json similarity index 100% rename from apps/router-testing/.eslintrc.json rename to apps/testing-router-outlet/.eslintrc.json diff --git a/apps/router-testing/README.md b/apps/testing-router-outlet/README.md similarity index 77% rename from apps/router-testing/README.md rename to apps/testing-router-outlet/README.md index 874daaaca..cd91ec548 100644 --- a/apps/router-testing/README.md +++ b/apps/testing-router-outlet/README.md @@ -16,9 +16,9 @@ We have a functional application that lists available books for borrowing inside The goal is to test this behavior with Testing library and Cypress -The file named `app.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test router-testing`. You can also install [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to execute your test by clicking on the `Run` button above each `describe` or `it` blocks. +The file named `app.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test testing-router-outlet`. You can also install [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) to execute your test by clicking on the `Run` button above each `describe` or `it` blocks. -For testing cypress, you will execute your test inside the `app.component.cy.ts` and run `npx nx component-test router-testing` to execute your test suits. You can add the `--watch` flag to execute your test in watch mode. +For testing cypress, you will execute your test inside the `app.component.cy.ts` and run `npx nx component-test testing-router-outlet` to execute your test suits. You can add the `--watch` flag to execute your test in watch mode. I created some `it` blocks but feel free to add more test if you like to. @@ -27,9 +27,9 @@ I created some `it` blocks but feel free to add more test if you like to. 1. Fork the project 2. clone it 3. npm install -4. `npx nx serve router-testing` to play with the application -5. `npx nx test router-testing` to test your application with Testing Library -6. `npx nx component-test router-testing --watch` to test your application with Cypress +4. `npx nx serve testing-router-outlet` to play with the application +5. `npx nx test testing-router-outlet` to test your application with Testing Library +6. `npx nx component-test testing-router-outlet --watch` to test your application with Cypress 7. _...work on it_ 8. Commit your work 9. Submit a PR with a title beginning with **Answer:17** that I will review and other dev can review. diff --git a/apps/router-testing/cypress.config.ts b/apps/testing-router-outlet/cypress.config.ts similarity index 100% rename from apps/router-testing/cypress.config.ts rename to apps/testing-router-outlet/cypress.config.ts diff --git a/apps/router-testing/cypress/fixtures/example.json b/apps/testing-router-outlet/cypress/fixtures/example.json similarity index 100% rename from apps/router-testing/cypress/fixtures/example.json rename to apps/testing-router-outlet/cypress/fixtures/example.json diff --git a/apps/router-testing/cypress/support/commands.ts b/apps/testing-router-outlet/cypress/support/commands.ts similarity index 100% rename from apps/router-testing/cypress/support/commands.ts rename to apps/testing-router-outlet/cypress/support/commands.ts diff --git a/apps/testing-router-outlet/cypress/support/component-index.html b/apps/testing-router-outlet/cypress/support/component-index.html new file mode 100644 index 000000000..4d7f518eb --- /dev/null +++ b/apps/testing-router-outlet/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + router-testing Components App + + +
+ + diff --git a/apps/router-testing/cypress/support/component.ts b/apps/testing-router-outlet/cypress/support/component.ts similarity index 100% rename from apps/router-testing/cypress/support/component.ts rename to apps/testing-router-outlet/cypress/support/component.ts diff --git a/apps/router-testing/cypress/tsconfig.cy.json b/apps/testing-router-outlet/cypress/tsconfig.cy.json similarity index 100% rename from apps/router-testing/cypress/tsconfig.cy.json rename to apps/testing-router-outlet/cypress/tsconfig.cy.json diff --git a/apps/router-testing/jest.config.ts b/apps/testing-router-outlet/jest.config.ts similarity index 93% rename from apps/router-testing/jest.config.ts rename to apps/testing-router-outlet/jest.config.ts index a25c74d94..f08ad64ef 100644 --- a/apps/router-testing/jest.config.ts +++ b/apps/testing-router-outlet/jest.config.ts @@ -1,6 +1,6 @@ /* eslint-disable */ export default { - displayName: 'router-testing', + displayName: 'testing-router-outlet', preset: '../../jest.preset.js', setupFilesAfterEnv: ['/src/test-setup.ts'], globals: {}, diff --git a/apps/router-testing/project.json b/apps/testing-router-outlet/project.json similarity index 66% rename from apps/router-testing/project.json rename to apps/testing-router-outlet/project.json index 25e09f904..190ef2652 100644 --- a/apps/router-testing/project.json +++ b/apps/testing-router-outlet/project.json @@ -1,25 +1,25 @@ { - "name": "router-testing", + "name": "testing-router-outlet", "$schema": "../../node_modules/nx/schemas/project-schema.json", "projectType": "application", - "sourceRoot": "apps/router-testing/src", + "sourceRoot": "apps/testing-router-outlet/src", "prefix": "app", "targets": { "build": { "executor": "@angular-devkit/build-angular:browser", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/apps/router-testing", - "index": "apps/router-testing/src/index.html", - "main": "apps/router-testing/src/main.ts", + "outputPath": "dist/apps/testing-router-outlet", + "index": "apps/testing-router-outlet/src/index.html", + "main": "apps/testing-router-outlet/src/main.ts", "polyfills": ["zone.js"], - "tsConfig": "apps/router-testing/tsconfig.app.json", + "tsConfig": "apps/testing-router-outlet/tsconfig.app.json", "inlineStyleLanguage": "scss", "assets": [ - "apps/router-testing/src/favicon.ico", - "apps/router-testing/src/assets" + "apps/testing-router-outlet/src/favicon.ico", + "apps/testing-router-outlet/src/assets" ], - "styles": ["apps/router-testing/src/styles.scss"], + "styles": ["apps/testing-router-outlet/src/styles.scss"], "scripts": [] }, "configurations": { @@ -53,10 +53,10 @@ "executor": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "router-testing:build:production" + "browserTarget": "testing-router-outlet:build:production" }, "development": { - "browserTarget": "router-testing:build:development" + "browserTarget": "testing-router-outlet:build:development" } }, "defaultConfiguration": "development" @@ -64,7 +64,7 @@ "extract-i18n": { "executor": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "router-testing:build" + "browserTarget": "testing-router-outlet:build" } }, "lint": { @@ -72,8 +72,8 @@ "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": [ - "apps/router-testing/**/*.ts", - "apps/router-testing/**/*.html" + "apps/testing-router-outlet/**/*.ts", + "apps/testing-router-outlet/**/*.html" ] } }, @@ -81,17 +81,17 @@ "executor": "@nrwl/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/router-testing/jest.config.ts", + "jestConfig": "apps/testing-router-outlet/jest.config.ts", "passWithNoTests": true } }, "component-test": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/router-testing/cypress.config.ts", + "cypressConfig": "apps/testing-router-outlet/cypress.config.ts", "testingType": "component", "skipServe": true, - "devServerTarget": "router-testing:build" + "devServerTarget": "testing-router-outlet:build" } } }, diff --git a/apps/router-testing/src/app/app.component.cy.ts b/apps/testing-router-outlet/src/app/app.component.cy.ts similarity index 100% rename from apps/router-testing/src/app/app.component.cy.ts rename to apps/testing-router-outlet/src/app/app.component.cy.ts diff --git a/apps/router-testing/src/app/app.component.spec.ts b/apps/testing-router-outlet/src/app/app.component.spec.ts similarity index 100% rename from apps/router-testing/src/app/app.component.spec.ts rename to apps/testing-router-outlet/src/app/app.component.spec.ts diff --git a/apps/router-testing/src/app/app.component.ts b/apps/testing-router-outlet/src/app/app.component.ts similarity index 100% rename from apps/router-testing/src/app/app.component.ts rename to apps/testing-router-outlet/src/app/app.component.ts diff --git a/apps/router-testing/src/app/app.routes.ts b/apps/testing-router-outlet/src/app/app.routes.ts similarity index 100% rename from apps/router-testing/src/app/app.routes.ts rename to apps/testing-router-outlet/src/app/app.routes.ts diff --git a/apps/router-testing/src/app/book.guard.ts b/apps/testing-router-outlet/src/app/book.guard.ts similarity index 100% rename from apps/router-testing/src/app/book.guard.ts rename to apps/testing-router-outlet/src/app/book.guard.ts diff --git a/apps/router-testing/src/app/book.model.ts b/apps/testing-router-outlet/src/app/book.model.ts similarity index 100% rename from apps/router-testing/src/app/book.model.ts rename to apps/testing-router-outlet/src/app/book.model.ts diff --git a/apps/router-testing/src/app/no-book-search.component.ts b/apps/testing-router-outlet/src/app/no-book-search.component.ts similarity index 100% rename from apps/router-testing/src/app/no-book-search.component.ts rename to apps/testing-router-outlet/src/app/no-book-search.component.ts diff --git a/apps/router-testing/src/app/search.component.ts b/apps/testing-router-outlet/src/app/search.component.ts similarity index 100% rename from apps/router-testing/src/app/search.component.ts rename to apps/testing-router-outlet/src/app/search.component.ts diff --git a/apps/router-testing/src/app/shelf.component.ts b/apps/testing-router-outlet/src/app/shelf.component.ts similarity index 100% rename from apps/router-testing/src/app/shelf.component.ts rename to apps/testing-router-outlet/src/app/shelf.component.ts diff --git a/apps/router-testing/src/assets/.gitkeep b/apps/testing-router-outlet/src/assets/.gitkeep similarity index 100% rename from apps/router-testing/src/assets/.gitkeep rename to apps/testing-router-outlet/src/assets/.gitkeep diff --git a/apps/router-testing/src/favicon.ico b/apps/testing-router-outlet/src/favicon.ico similarity index 100% rename from apps/router-testing/src/favicon.ico rename to apps/testing-router-outlet/src/favicon.ico diff --git a/apps/router-testing/src/index.html b/apps/testing-router-outlet/src/index.html similarity index 100% rename from apps/router-testing/src/index.html rename to apps/testing-router-outlet/src/index.html diff --git a/apps/router-testing/src/main.ts b/apps/testing-router-outlet/src/main.ts similarity index 100% rename from apps/router-testing/src/main.ts rename to apps/testing-router-outlet/src/main.ts diff --git a/apps/router-testing/src/styles.scss b/apps/testing-router-outlet/src/styles.scss similarity index 100% rename from apps/router-testing/src/styles.scss rename to apps/testing-router-outlet/src/styles.scss diff --git a/apps/router-testing/src/test-setup.ts b/apps/testing-router-outlet/src/test-setup.ts similarity index 100% rename from apps/router-testing/src/test-setup.ts rename to apps/testing-router-outlet/src/test-setup.ts diff --git a/apps/router-testing/tsconfig.app.json b/apps/testing-router-outlet/tsconfig.app.json similarity index 100% rename from apps/router-testing/tsconfig.app.json rename to apps/testing-router-outlet/tsconfig.app.json diff --git a/apps/router-testing/tsconfig.editor.json b/apps/testing-router-outlet/tsconfig.editor.json similarity index 100% rename from apps/router-testing/tsconfig.editor.json rename to apps/testing-router-outlet/tsconfig.editor.json diff --git a/apps/router-testing/tsconfig.json b/apps/testing-router-outlet/tsconfig.json similarity index 100% rename from apps/router-testing/tsconfig.json rename to apps/testing-router-outlet/tsconfig.json diff --git a/apps/router-testing/tsconfig.spec.json b/apps/testing-router-outlet/tsconfig.spec.json similarity index 100% rename from apps/router-testing/tsconfig.spec.json rename to apps/testing-router-outlet/tsconfig.spec.json