feat(doc): move nested

This commit is contained in:
thomas
2023-10-17 23:12:53 +02:00
parent be270efde1
commit a855cb0a8a
27 changed files with 41 additions and 42 deletions

View File

@@ -1,5 +1,5 @@
{
"extends": ["../../.eslintrc.json"],
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{

View File

@@ -5,7 +5,7 @@
### Run Application
```bash
npx nx serve testing-nested
npx nx serve test-nested
```
### Documentation and Instruction

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>testing-nested Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>

View File

@@ -1,7 +1,7 @@
/* eslint-disable */
export default {
displayName: 'testing-nested',
preset: '../../jest.preset.js',
displayName: 'test-nested',
preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
transform: {
'^.+\\.(ts|mjs|js|html)$': [

View File

@@ -1,25 +1,25 @@
{
"name": "testing-nested",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"name": "test-nested",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/testing-nested/src",
"sourceRoot": "apps/test/nested/src",
"prefix": "app",
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/testing-nested",
"index": "apps/testing-nested/src/index.html",
"main": "apps/testing-nested/src/main.ts",
"outputPath": "dist/apps/test/nested",
"index": "apps/test/nested/src/index.html",
"main": "apps/test/nested/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/testing-nested/tsconfig.app.json",
"tsConfig": "apps/test/nested/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"apps/testing-nested/src/favicon.ico",
"apps/testing-nested/src/assets"
"apps/test/nested/src/favicon.ico",
"apps/test/nested/src/assets"
],
"styles": ["apps/testing-nested/src/styles.scss"],
"styles": ["apps/test/nested/src/styles.scss"],
"scripts": []
},
"configurations": {
@@ -53,10 +53,10 @@
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "testing-nested:build:production"
"browserTarget": "test-nested:build:production"
},
"development": {
"browserTarget": "testing-nested:build:development"
"browserTarget": "test-nested:build:development"
}
},
"defaultConfiguration": "development"
@@ -64,7 +64,7 @@
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "testing-nested:build"
"browserTarget": "test-nested:build"
}
},
"lint": {
@@ -72,8 +72,8 @@
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"apps/testing-nested/**/*.ts",
"apps/testing-nested/**/*.html"
"apps/test/nested/**/*.ts",
"apps/test/nested/**/*.html"
]
}
},
@@ -81,7 +81,7 @@
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/testing-nested/jest.config.ts",
"jestConfig": "apps/test/nested/jest.config.ts",
"passWithNoTests": true
},
"configurations": {
@@ -94,10 +94,10 @@
"component-test": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/testing-nested/cypress.config.ts",
"cypressConfig": "apps/test/nested/cypress.config.ts",
"testingType": "component",
"skipServe": true,
"devServerTarget": "testing-nested:build"
"devServerTarget": "test-nested:build"
}
}
},

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"outDir": "../../../dist/out-tsc",
"types": []
},
"files": ["src/main.ts"],

View File

@@ -25,7 +25,7 @@
"path": "./cypress/tsconfig.json"
}
],
"extends": "../../tsconfig.base.json",
"extends": "../../../tsconfig.base.json",
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,

View File

@@ -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"]
},

View File

@@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>testing-nested Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>

View File

@@ -3,7 +3,7 @@ title: 🟠 Nested Components
description: Challenge 18 is about testing nested components
author: Thomas Laforge
challengeNumber: 18
command: testing-nested
command: test-nested
sidebar:
order: 109
---
@@ -14,11 +14,11 @@ We have a small application that sends a title, typed into an input to a fake ba
If the title is correctly typed, you can send the request otherwise you receive an error and the request is not sent.
The application is created with <b>nested components</b>. `ChildComponent` is the container that includes four components: `ResultComponent`, `ButtonComponent`, `InputComponent` and `ErrorComponent`. However since we are testing our component as a black box, the architecture of our components doesn't change anything. You can create your test, change how the components are structured, and your tests should still pass. That's the goal of integration tests. <b>Never test internal implementation details!!!</b>.
You can play with it by running : `npx nx serve testing-nested`.
You can play with it by running : `npx nx serve test-nested`.
The file named `child.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test testing-nested`. 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 `child.component.spec.ts` will let test your application using Testing Library. To run the test suits, you need to run `npx nx test test-nested`. 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-nested` 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-nested` to execute your test suits. You can add the `--watch` flag to execute your test in watch mode.
# Statement