Skip to content

Commit

Permalink
test: fix demo app test and create affected test command
Browse files Browse the repository at this point in the history
  • Loading branch information
pjlamb12 committed Sep 22, 2021
1 parent 8cb3a9a commit ffb1ce7
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 121 deletions.
36 changes: 11 additions & 25 deletions apps/runtime-config-loader-demo/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
import { TestBed } from '@angular/core/testing';
import { RuntimeConfigLoaderService } from 'runtime-config-loader';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AppComponent],
}).compileComponents();
});
let app: AppComponent;
let mockRuntimeConfigService = {} as RuntimeConfigLoaderService;

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
beforeEach(() => {
app = new AppComponent(
mockRuntimeConfigService as RuntimeConfigLoaderService
);
});

it(`should have as title 'runtime-config-loader-demo'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('runtime-config-loader-demo');
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain(
'Welcome to runtime-config-loader-demo!'
);
});
it('should create the app', () => {
expect(app).toBeTruthy();
});
});
80 changes: 40 additions & 40 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
{
"npmScope": "runtime-config-loader",
"affected": {
"defaultBase": "master"
},
"implicitDependencies": {
"package.json": {
"dependencies": "*",
"devDependencies": "*"
},
".eslintrc.json": "*"
},
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/nx-cloud",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"],
"accessToken": "M2EyMjNlOWUtNjk1MC00Nzc1LWEyZWYtZWFiNDQ0ZjliNzY0fHJlYWQtd3JpdGU="
}
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
},
"projects": {
"runtime-config-loader": {
"tags": ["scope:shared", "type:util"]
},
"runtime-config-loader-demo": {
"tags": []
},
"runtime-config-loader-demo-e2e": {
"tags": [],
"implicitDependencies": ["runtime-config-loader-demo"]
}
}
"npmScope": "runtime-config-loader",
"affected": {
"defaultBase": "main"
},
"implicitDependencies": {
"package.json": {
"dependencies": "*",
"devDependencies": "*"
},
".eslintrc.json": "*"
},
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/nx-cloud",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"],
"accessToken": "M2EyMjNlOWUtNjk1MC00Nzc1LWEyZWYtZWFiNDQ0ZjliNzY0fHJlYWQtd3JpdGU="
}
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
},
"projects": {
"runtime-config-loader": {
"tags": ["scope:shared", "type:util"]
},
"runtime-config-loader-demo": {
"tags": []
},
"runtime-config-loader-demo-e2e": {
"tags": [],
"implicitDependencies": ["runtime-config-loader-demo"]
}
}
}
113 changes: 57 additions & 56 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
{
"name": "runtime-config-loader",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "nx",
"postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main",
"start": "nx serve",
"build": "nx build",
"test": "nx test"
},
"private": true,
"dependencies": {
"@angular/animations": "^12.2.0",
"@angular/common": "^12.2.0",
"@angular/compiler": "^12.2.0",
"@angular/core": "^12.2.0",
"@angular/forms": "^12.2.0",
"@angular/platform-browser": "^12.2.0",
"@angular/platform-browser-dynamic": "^12.2.0",
"@angular/router": "^12.2.0",
"@nrwl/angular": "12.9.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.0",
"@angular-eslint/eslint-plugin": "~12.3.0",
"@angular-eslint/eslint-plugin-template": "~12.3.0",
"@angular-eslint/template-parser": "~12.3.0",
"@angular/cli": "~12.2.0",
"@angular/compiler-cli": "^12.2.0",
"@angular/language-service": "^12.2.0",
"@nrwl/cli": "12.9.0",
"@nrwl/cypress": "12.9.0",
"@nrwl/eslint-plugin-nx": "12.9.0",
"@nrwl/jest": "12.9.0",
"@nrwl/linter": "12.9.0",
"@nrwl/nx-cloud": "latest",
"@nrwl/tao": "12.9.0",
"@nrwl/workspace": "12.9.0",
"@types/jest": "26.0.24",
"@types/node": "14.14.33",
"@typescript-eslint/eslint-plugin": "~4.28.3",
"@typescript-eslint/parser": "~4.28.3",
"cypress": "^8.3.0",
"eslint": "7.22.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-cypress": "^2.10.3",
"jest": "27.0.3",
"jest-preset-angular": "9.0.7",
"ng-packagr": "^12.1.1",
"prettier": "^2.3.1",
"ts-jest": "27.0.3",
"typescript": "~4.3.5"
}
"name": "runtime-config-loader",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "nx",
"postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2015 browser module main",
"start": "nx serve",
"build": "nx build",
"test": "nx test",
"affected:test": "nx affected --target test --parallel --maxParallel 3"
},
"private": true,
"dependencies": {
"@angular/animations": "^12.2.0",
"@angular/common": "^12.2.0",
"@angular/compiler": "^12.2.0",
"@angular/core": "^12.2.0",
"@angular/forms": "^12.2.0",
"@angular/platform-browser": "^12.2.0",
"@angular/platform-browser-dynamic": "^12.2.0",
"@angular/router": "^12.2.0",
"@nrwl/angular": "12.9.0",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.0",
"@angular-eslint/eslint-plugin": "~12.3.0",
"@angular-eslint/eslint-plugin-template": "~12.3.0",
"@angular-eslint/template-parser": "~12.3.0",
"@angular/cli": "~12.2.0",
"@angular/compiler-cli": "^12.2.0",
"@angular/language-service": "^12.2.0",
"@nrwl/cli": "12.9.0",
"@nrwl/cypress": "12.9.0",
"@nrwl/eslint-plugin-nx": "12.9.0",
"@nrwl/jest": "12.9.0",
"@nrwl/linter": "12.9.0",
"@nrwl/nx-cloud": "latest",
"@nrwl/tao": "12.9.0",
"@nrwl/workspace": "12.9.0",
"@types/jest": "26.0.24",
"@types/node": "14.14.33",
"@typescript-eslint/eslint-plugin": "~4.28.3",
"@typescript-eslint/parser": "~4.28.3",
"cypress": "^8.3.0",
"eslint": "7.22.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-cypress": "^2.10.3",
"jest": "27.0.3",
"jest-preset-angular": "9.0.7",
"ng-packagr": "^12.1.1",
"prettier": "^2.3.1",
"ts-jest": "27.0.3",
"typescript": "~4.3.5"
}
}

0 comments on commit ffb1ce7

Please sign in to comment.