From be270efde16ffc0ff5ce50fb8b9b4f1dd445d435 Mon Sep 17 00:00:00 2001 From: thomas Date: Tue, 17 Oct 2023 23:12:11 +0200 Subject: [PATCH] feat(doc): move input-output --- .../input-output}/.eslintrc.json | 2 +- .../input-output}/README.md | 2 +- .../input-output}/cypress.config.ts | 0 .../cypress/fixtures/example.json | 0 .../input-output}/cypress/support/commands.ts | 0 .../cypress/support/component-index.html | 12 ++++++ .../cypress/support/component.ts | 0 .../input-output}/cypress/tsconfig.json | 0 .../input-output}/jest.config.ts | 4 +- .../input-output}/project.json | 36 +++++++++--------- .../input-output}/src/app/app.component.ts | 0 .../src/app/counter.component.cy.ts | 0 .../src/app/counter.component.spec.ts | 0 .../src/app/counter.component.ts | 0 .../input-output}/src/assets/.gitkeep | 0 .../input-output}/src/favicon.ico | Bin .../input-output}/src/index.html | 0 .../input-output}/src/main.ts | 0 .../input-output}/src/styles.scss | 0 .../input-output}/src/test-setup.ts | 0 .../input-output}/tsconfig.app.json | 2 +- .../input-output}/tsconfig.editor.json | 0 .../input-output}/tsconfig.json | 2 +- .../input-output}/tsconfig.spec.json | 2 +- .../cypress/support/component-index.html | 13 ------- .../challenges/testing/19-input-output.md | 8 ++-- 26 files changed, 41 insertions(+), 42 deletions(-) rename apps/{testing-input-output => test/input-output}/.eslintrc.json (94%) rename apps/{testing-input-output => test/input-output}/README.md (86%) rename apps/{testing-input-output => test/input-output}/cypress.config.ts (100%) rename apps/{testing-input-output => test/input-output}/cypress/fixtures/example.json (100%) rename apps/{testing-input-output => test/input-output}/cypress/support/commands.ts (100%) create mode 100644 apps/test/input-output/cypress/support/component-index.html rename apps/{testing-input-output => test/input-output}/cypress/support/component.ts (100%) rename apps/{testing-input-output => test/input-output}/cypress/tsconfig.json (100%) rename apps/{testing-input-output => test/input-output}/jest.config.ts (88%) rename apps/{testing-input-output => test/input-output}/project.json (66%) rename apps/{testing-input-output => test/input-output}/src/app/app.component.ts (100%) rename apps/{testing-input-output => test/input-output}/src/app/counter.component.cy.ts (100%) rename apps/{testing-input-output => test/input-output}/src/app/counter.component.spec.ts (100%) rename apps/{testing-input-output => test/input-output}/src/app/counter.component.ts (100%) rename apps/{testing-input-output => test/input-output}/src/assets/.gitkeep (100%) rename apps/{testing-input-output => test/input-output}/src/favicon.ico (100%) rename apps/{testing-input-output => test/input-output}/src/index.html (100%) rename apps/{testing-input-output => test/input-output}/src/main.ts (100%) rename apps/{testing-input-output => test/input-output}/src/styles.scss (100%) rename apps/{testing-input-output => test/input-output}/src/test-setup.ts (100%) rename apps/{testing-input-output => test/input-output}/tsconfig.app.json (89%) rename apps/{testing-input-output => test/input-output}/tsconfig.editor.json (100%) rename apps/{testing-input-output => test/input-output}/tsconfig.json (94%) rename apps/{testing-input-output => test/input-output}/tsconfig.spec.json (88%) delete mode 100644 apps/testing-input-output/cypress/support/component-index.html diff --git a/apps/testing-input-output/.eslintrc.json b/apps/test/input-output/.eslintrc.json similarity index 94% rename from apps/testing-input-output/.eslintrc.json rename to apps/test/input-output/.eslintrc.json index b428c22..bf8df14 100644 --- a/apps/testing-input-output/.eslintrc.json +++ b/apps/test/input-output/.eslintrc.json @@ -1,5 +1,5 @@ { - "extends": ["../../.eslintrc.json"], + "extends": ["../../../.eslintrc.json"], "ignorePatterns": ["!**/*"], "overrides": [ { diff --git a/apps/testing-input-output/README.md b/apps/test/input-output/README.md similarity index 86% rename from apps/testing-input-output/README.md rename to apps/test/input-output/README.md index 127480a..cb3c1ac 100644 --- a/apps/testing-input-output/README.md +++ b/apps/test/input-output/README.md @@ -5,7 +5,7 @@ ### Run Application ```bash -npx nx serve testing-input-output +npx nx serve test-input-output ``` ### Documentation and Instruction diff --git a/apps/testing-input-output/cypress.config.ts b/apps/test/input-output/cypress.config.ts similarity index 100% rename from apps/testing-input-output/cypress.config.ts rename to apps/test/input-output/cypress.config.ts diff --git a/apps/testing-input-output/cypress/fixtures/example.json b/apps/test/input-output/cypress/fixtures/example.json similarity index 100% rename from apps/testing-input-output/cypress/fixtures/example.json rename to apps/test/input-output/cypress/fixtures/example.json diff --git a/apps/testing-input-output/cypress/support/commands.ts b/apps/test/input-output/cypress/support/commands.ts similarity index 100% rename from apps/testing-input-output/cypress/support/commands.ts rename to apps/test/input-output/cypress/support/commands.ts diff --git a/apps/test/input-output/cypress/support/component-index.html b/apps/test/input-output/cypress/support/component-index.html new file mode 100644 index 0000000..c04f2f6 --- /dev/null +++ b/apps/test/input-output/cypress/support/component-index.html @@ -0,0 +1,12 @@ + + + + + + + testing-input-output Components App + + +
+ + diff --git a/apps/testing-input-output/cypress/support/component.ts b/apps/test/input-output/cypress/support/component.ts similarity index 100% rename from apps/testing-input-output/cypress/support/component.ts rename to apps/test/input-output/cypress/support/component.ts diff --git a/apps/testing-input-output/cypress/tsconfig.json b/apps/test/input-output/cypress/tsconfig.json similarity index 100% rename from apps/testing-input-output/cypress/tsconfig.json rename to apps/test/input-output/cypress/tsconfig.json diff --git a/apps/testing-input-output/jest.config.ts b/apps/test/input-output/jest.config.ts similarity index 88% rename from apps/testing-input-output/jest.config.ts rename to apps/test/input-output/jest.config.ts index 8690df0..33b7753 100644 --- a/apps/testing-input-output/jest.config.ts +++ b/apps/test/input-output/jest.config.ts @@ -1,7 +1,7 @@ /* eslint-disable */ export default { - displayName: 'testing-input-output', - preset: '../../jest.preset.js', + displayName: 'test-input-output', + preset: '../../../jest.preset.js', setupFilesAfterEnv: ['/src/test-setup.ts'], transform: { '^.+\\.(ts|mjs|js|html)$': [ diff --git a/apps/testing-input-output/project.json b/apps/test/input-output/project.json similarity index 66% rename from apps/testing-input-output/project.json rename to apps/test/input-output/project.json index d6b0934..91aae78 100644 --- a/apps/testing-input-output/project.json +++ b/apps/test/input-output/project.json @@ -1,25 +1,25 @@ { - "name": "testing-input-output", - "$schema": "../node_modules/nx/schemas/project-schema.json", + "name": "test-input-output", + "$schema": "../../../node_modules/nx/schemas/project-schema.json", "projectType": "application", - "sourceRoot": "apps/testing-input-output/src", + "sourceRoot": "apps/test/input-output/src", "prefix": "app", "targets": { "build": { "executor": "@angular-devkit/build-angular:browser", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/apps/testing-input-output", - "index": "apps/testing-input-output/src/index.html", - "main": "apps/testing-input-output/src/main.ts", + "outputPath": "dist/apps/test/input-output", + "index": "apps/test/input-output/src/index.html", + "main": "apps/test/input-output/src/main.ts", "polyfills": ["zone.js"], - "tsConfig": "apps/testing-input-output/tsconfig.app.json", + "tsConfig": "apps/test/input-output/tsconfig.app.json", "inlineStyleLanguage": "scss", "assets": [ - "apps/testing-input-output/src/favicon.ico", - "apps/testing-input-output/src/assets" + "apps/test/input-output/src/favicon.ico", + "apps/test/input-output/src/assets" ], - "styles": ["apps/testing-input-output/src/styles.scss"], + "styles": ["apps/test/input-output/src/styles.scss"], "scripts": [] }, "configurations": { @@ -53,10 +53,10 @@ "executor": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "testing-input-output:build:production" + "browserTarget": "test-input-output:build:production" }, "development": { - "browserTarget": "testing-input-output:build:development" + "browserTarget": "test-input-output:build:development" } }, "defaultConfiguration": "development" @@ -64,7 +64,7 @@ "extract-i18n": { "executor": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "testing-input-output:build" + "browserTarget": "test-input-output:build" } }, "lint": { @@ -72,8 +72,8 @@ "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": [ - "apps/testing-input-output/**/*.ts", - "apps/testing-input-output/**/*.html" + "apps/test/input-output/**/*.ts", + "apps/test/input-output/**/*.html" ] } }, @@ -81,7 +81,7 @@ "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "options": { - "jestConfig": "apps/testing-input-output/jest.config.ts", + "jestConfig": "apps/test/input-output/jest.config.ts", "passWithNoTests": true }, "configurations": { @@ -94,10 +94,10 @@ "component-test": { "executor": "@nx/cypress:cypress", "options": { - "cypressConfig": "apps/testing-input-output/cypress.config.ts", + "cypressConfig": "apps/test/input-output/cypress.config.ts", "testingType": "component", "skipServe": true, - "devServerTarget": "testing-input-output:build" + "devServerTarget": "test-input-output:build" } } }, diff --git a/apps/testing-input-output/src/app/app.component.ts b/apps/test/input-output/src/app/app.component.ts similarity index 100% rename from apps/testing-input-output/src/app/app.component.ts rename to apps/test/input-output/src/app/app.component.ts diff --git a/apps/testing-input-output/src/app/counter.component.cy.ts b/apps/test/input-output/src/app/counter.component.cy.ts similarity index 100% rename from apps/testing-input-output/src/app/counter.component.cy.ts rename to apps/test/input-output/src/app/counter.component.cy.ts diff --git a/apps/testing-input-output/src/app/counter.component.spec.ts b/apps/test/input-output/src/app/counter.component.spec.ts similarity index 100% rename from apps/testing-input-output/src/app/counter.component.spec.ts rename to apps/test/input-output/src/app/counter.component.spec.ts diff --git a/apps/testing-input-output/src/app/counter.component.ts b/apps/test/input-output/src/app/counter.component.ts similarity index 100% rename from apps/testing-input-output/src/app/counter.component.ts rename to apps/test/input-output/src/app/counter.component.ts diff --git a/apps/testing-input-output/src/assets/.gitkeep b/apps/test/input-output/src/assets/.gitkeep similarity index 100% rename from apps/testing-input-output/src/assets/.gitkeep rename to apps/test/input-output/src/assets/.gitkeep diff --git a/apps/testing-input-output/src/favicon.ico b/apps/test/input-output/src/favicon.ico similarity index 100% rename from apps/testing-input-output/src/favicon.ico rename to apps/test/input-output/src/favicon.ico diff --git a/apps/testing-input-output/src/index.html b/apps/test/input-output/src/index.html similarity index 100% rename from apps/testing-input-output/src/index.html rename to apps/test/input-output/src/index.html diff --git a/apps/testing-input-output/src/main.ts b/apps/test/input-output/src/main.ts similarity index 100% rename from apps/testing-input-output/src/main.ts rename to apps/test/input-output/src/main.ts diff --git a/apps/testing-input-output/src/styles.scss b/apps/test/input-output/src/styles.scss similarity index 100% rename from apps/testing-input-output/src/styles.scss rename to apps/test/input-output/src/styles.scss diff --git a/apps/testing-input-output/src/test-setup.ts b/apps/test/input-output/src/test-setup.ts similarity index 100% rename from apps/testing-input-output/src/test-setup.ts rename to apps/test/input-output/src/test-setup.ts diff --git a/apps/testing-input-output/tsconfig.app.json b/apps/test/input-output/tsconfig.app.json similarity index 89% rename from apps/testing-input-output/tsconfig.app.json rename to apps/test/input-output/tsconfig.app.json index e46d4fc..01a02ed 100644 --- a/apps/testing-input-output/tsconfig.app.json +++ b/apps/test/input-output/tsconfig.app.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "../../../dist/out-tsc", "types": [] }, "files": ["src/main.ts"], diff --git a/apps/testing-input-output/tsconfig.editor.json b/apps/test/input-output/tsconfig.editor.json similarity index 100% rename from apps/testing-input-output/tsconfig.editor.json rename to apps/test/input-output/tsconfig.editor.json diff --git a/apps/testing-input-output/tsconfig.json b/apps/test/input-output/tsconfig.json similarity index 94% rename from apps/testing-input-output/tsconfig.json rename to apps/test/input-output/tsconfig.json index 28546c4..3879b94 100644 --- a/apps/testing-input-output/tsconfig.json +++ b/apps/test/input-output/tsconfig.json @@ -25,7 +25,7 @@ "path": "./cypress/tsconfig.json" } ], - "extends": "../../tsconfig.base.json", + "extends": "../../../tsconfig.base.json", "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, diff --git a/apps/testing-input-output/tsconfig.spec.json b/apps/test/input-output/tsconfig.spec.json similarity index 88% rename from apps/testing-input-output/tsconfig.spec.json rename to apps/test/input-output/tsconfig.spec.json index 1a4817a..c0c092e 100644 --- a/apps/testing-input-output/tsconfig.spec.json +++ b/apps/test/input-output/tsconfig.spec.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "../../../dist/out-tsc", "module": "commonjs", "types": ["jest", "node", "@testing-library/jest-dom"] }, diff --git a/apps/testing-input-output/cypress/support/component-index.html b/apps/testing-input-output/cypress/support/component-index.html deleted file mode 100644 index 77c5aaf..0000000 --- a/apps/testing-input-output/cypress/support/component-index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - testing-input-output Components App - - - -
- - diff --git a/docs/src/content/docs/challenges/testing/19-input-output.md b/docs/src/content/docs/challenges/testing/19-input-output.md index b461f4e..d08acba 100644 --- a/docs/src/content/docs/challenges/testing/19-input-output.md +++ b/docs/src/content/docs/challenges/testing/19-input-output.md @@ -3,7 +3,7 @@ title: 🟠 Input Output description: Challenge 19 is about testing inputs and ouputs author: Thomas Laforge challengeNumber: 19 -command: testing-input-output +command: test-input-output sidebar: order: 110 --- @@ -12,11 +12,11 @@ sidebar: We have a small counter application that increments or decrements a number. The `CounterComponent` takes an initial value as an `@Input` and emits the result of the counter as an `@Output` when we click on the **Send** button. Since we are testing our component as a black box, we only have access to our inputs and listen to the output values. We should not rely on any internal implementation details!!! -You can play with it by running : `npx nx serve testing-input-output`. +You can play with it by running : `npx nx serve test-input-output`. -The file named `counter.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test testing-input-output`. 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 `counter.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test test-input-output`. 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 `child.component.cy.ts` and run `npx nx component-test testing-input-output` 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 `child.component.cy.ts` and run `npx nx component-test test-input-output` to execute your test suits. You can add the `--watch` flag to execute your test in watch mode. # Statement