From 5b64470d1fd08cf848ca226a68229e0d509f4cd5 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Mon, 30 Sep 2019 17:54:47 -0400 Subject: [PATCH] Refactoring --- Display/angular.json | 250 +++++++++--------- Display/karma.conf.js | 54 ++-- .../app/components/app/app.component.spec.ts | 52 ++-- .../src/app/components/app/app.component.ts | 8 +- .../dashboard/dashboard.component.spec.ts | 32 +-- .../dashboard/dashboard.component.ts | 12 +- .../components/laundry/laundry.component.html | 1 + .../components/laundry/laundry.component.scss | 12 +- .../laundry/laundry.component.spec.ts | 32 +-- .../components/laundry/laundry.component.ts | 2 +- .../src/app/components/nav/nav.component.scss | 2 +- .../app/components/nav/nav.component.spec.ts | 48 ++-- .../src/app/components/nav/nav.component.ts | 20 +- .../charts/weather-charts.component.scss | 18 +- .../charts/weather-charts.component.spec.ts | 32 +-- .../charts/weather-charts.component.ts | 2 +- .../current/weather-current.component.scss | 8 +- .../current/weather-current.component.spec.ts | 32 +-- .../current/weather-current.component.ts | 2 +- .../app/models/laundry/laundry-status.spec.ts | 7 + .../laundry/laundry-status.ts | 0 .../models/weather/weather-reading.spec.ts | 7 + .../weather/weather-reading.ts | 0 .../weather/weather-value.ts | 0 .../services/laundry/laundry-status.spec.ts | 7 - .../services/laundry/laundry.service.spec.ts | 10 +- .../app/services/laundry/laundry.service.ts | 6 +- .../services/weather/weather-reading.spec.ts | 7 - .../services/weather/weather.service.spec.ts | 10 +- .../app/services/weather/weather.service.ts | 2 +- Display/src/test.ts | 8 +- Display/tsconfig.app.json | 32 +-- Display/tsconfig.json | 48 ++-- Display/tsconfig.spec.json | 30 +-- Display/tslint.json | 176 ++++++------ 35 files changed, 484 insertions(+), 485 deletions(-) create mode 100644 Display/src/app/models/laundry/laundry-status.spec.ts rename Display/src/app/{services => models}/laundry/laundry-status.ts (100%) create mode 100644 Display/src/app/models/weather/weather-reading.spec.ts rename Display/src/app/{services => models}/weather/weather-reading.ts (100%) rename Display/src/app/{services => models}/weather/weather-value.ts (100%) delete mode 100644 Display/src/app/services/laundry/laundry-status.spec.ts delete mode 100644 Display/src/app/services/weather/weather-reading.spec.ts diff --git a/Display/angular.json b/Display/angular.json index 5441208..691cfee 100644 --- a/Display/angular.json +++ b/Display/angular.json @@ -1,132 +1,132 @@ { - "$schema": "./node_modules/@angular/cli/lib/config/schema.json", - "version": 1, - "newProjectRoot": "projects", - "projects": { - "Display": { - "projectType": "application", - "schematics": { - "@schematics/angular:component": { - "style": "scss" - } - }, - "root": "", - "sourceRoot": "src", - "prefix": "app", - "architect": { - "build": { - "builder": "@angular-devkit/build-angular:browser", - "options": { - "outputPath": "dist/Display", - "index": "src/index.html", - "main": "src/main.ts", - "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.app.json", - "aot": false, - "assets": [ - "src/favicon.ico", - "src/assets" - ], - "styles": [ - "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css", - "src/styles.scss" - ], - "scripts": [] - }, - "configurations": { - "production": { - "fileReplacements": [ - { - "replace": "src/environments/environment.ts", - "with": "src/environments/environment.prod.ts" + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "Display": { + "projectType": "application", + "schematics": { + "@schematics/angular:component": { + "style": "scss" } - ], - "optimization": true, - "outputHashing": "all", - "sourceMap": false, - "extractCss": true, - "namedChunks": false, - "aot": true, - "extractLicenses": true, - "vendorChunk": false, - "buildOptimizer": true, - "budgets": [ - { - "type": "initial", - "maximumWarning": "2mb", - "maximumError": "5mb" + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "dist/Display", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "aot": false, + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css", + "src/styles.scss" + ], + "scripts": [] + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + } + } }, - { - "type": "anyComponentStyle", - "maximumWarning": "6kb", - "maximumError": "10kb" + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "Display:build" + }, + "configurations": { + "production": { + "browserTarget": "Display:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "Display:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css", + "src/styles.scss" + ], + "scripts": [] + } + }, + "lint": { + "builder": "@angular-devkit/build-angular:tslint", + "options": { + "tsConfig": [ + "tsconfig.app.json", + "tsconfig.spec.json", + "e2e/tsconfig.json" + ], + "exclude": [ + "**/node_modules/**" + ] + } + }, + "e2e": { + "builder": "@angular-devkit/build-angular:protractor", + "options": { + "protractorConfig": "e2e/protractor.conf.js", + "devServerTarget": "Display:serve" + }, + "configurations": { + "production": { + "devServerTarget": "Display:serve:production" + } + } } - ] } - } - }, - "serve": { - "builder": "@angular-devkit/build-angular:dev-server", - "options": { - "browserTarget": "Display:build" - }, - "configurations": { - "production": { - "browserTarget": "Display:build:production" - } - } - }, - "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "browserTarget": "Display:build" - } - }, - "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "src/test.ts", - "polyfills": "src/polyfills.ts", - "tsConfig": "tsconfig.spec.json", - "karmaConfig": "karma.conf.js", - "assets": [ - "src/favicon.ico", - "src/assets" - ], - "styles": [ - "./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css", - "src/styles.scss" - ], - "scripts": [] - } - }, - "lint": { - "builder": "@angular-devkit/build-angular:tslint", - "options": { - "tsConfig": [ - "tsconfig.app.json", - "tsconfig.spec.json", - "e2e/tsconfig.json" - ], - "exclude": [ - "**/node_modules/**" - ] - } - }, - "e2e": { - "builder": "@angular-devkit/build-angular:protractor", - "options": { - "protractorConfig": "e2e/protractor.conf.js", - "devServerTarget": "Display:serve" - }, - "configurations": { - "production": { - "devServerTarget": "Display:serve:production" - } - } } - } - } - }, - "defaultProject": "Display" + }, + "defaultProject": "Display" } diff --git a/Display/karma.conf.js b/Display/karma.conf.js index 134c047..0fe0f3f 100644 --- a/Display/karma.conf.js +++ b/Display/karma.conf.js @@ -2,31 +2,31 @@ // https://karma-runner.github.io/1.0/config/configuration-file.html module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, './coverage/Display'), - reports: ['html', 'lcovonly', 'text-summary'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + dir: require('path').join(__dirname, './coverage/Display'), + reports: ['html', 'lcovonly', 'text-summary'], + fixWebpackSourcePaths: true + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true + }); }; diff --git a/Display/src/app/components/app/app.component.spec.ts b/Display/src/app/components/app/app.component.spec.ts index 8ed092f..b61be34 100644 --- a/Display/src/app/components/app/app.component.spec.ts +++ b/Display/src/app/components/app/app.component.spec.ts @@ -3,33 +3,33 @@ import { RouterTestingModule } from '@angular/router/testing'; import { AppComponent } from './app.component'; describe('AppComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - RouterTestingModule - ], - declarations: [ - AppComponent - ], - }).compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports: [ + RouterTestingModule + ], + declarations: [ + AppComponent + ], + }).compileComponents(); + })); - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - }); + it('should create the app', () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app).toBeTruthy(); + }); - it(`should have as title 'Display'`, () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('Display'); - }); + it(`should have as title 'Display'`, () => { + const fixture = TestBed.createComponent(AppComponent); + const app = fixture.debugElement.componentInstance; + expect(app.title).toEqual('Display'); + }); - it('should render title', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('.content span').textContent).toContain('Display app is running!'); - }); + it('should render title', () => { + const fixture = TestBed.createComponent(AppComponent); + fixture.detectChanges(); + const compiled = fixture.debugElement.nativeElement; + expect(compiled.querySelector('.content span').textContent).toContain('Display app is running!'); + }); }); diff --git a/Display/src/app/components/app/app.component.ts b/Display/src/app/components/app/app.component.ts index 899dcd6..88e010f 100644 --- a/Display/src/app/components/app/app.component.ts +++ b/Display/src/app/components/app/app.component.ts @@ -1,10 +1,10 @@ import { Component } from '@angular/core'; @Component({ - selector: 'app-root', - templateUrl: './app.component.html', - styleUrls: ['./app.component.scss'] + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.scss'] }) export class AppComponent { - title = 'Display'; + title = 'Display'; } diff --git a/Display/src/app/components/dashboard/dashboard.component.spec.ts b/Display/src/app/components/dashboard/dashboard.component.spec.ts index 9c996c3..5629670 100644 --- a/Display/src/app/components/dashboard/dashboard.component.spec.ts +++ b/Display/src/app/components/dashboard/dashboard.component.spec.ts @@ -3,23 +3,23 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DashboardComponent } from './dashboard.component'; describe('DashboardComponent', () => { - let component: DashboardComponent; - let fixture: ComponentFixture; + let component: DashboardComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ DashboardComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [DashboardComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(DashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(DashboardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/Display/src/app/components/dashboard/dashboard.component.ts b/Display/src/app/components/dashboard/dashboard.component.ts index 0824577..9787ddf 100644 --- a/Display/src/app/components/dashboard/dashboard.component.ts +++ b/Display/src/app/components/dashboard/dashboard.component.ts @@ -1,15 +1,15 @@ import { Component, OnInit } from '@angular/core'; @Component({ - selector: 'app-dashboard', - templateUrl: './dashboard.component.html', - styleUrls: ['./dashboard.component.scss'] + selector: 'app-dashboard', + templateUrl: './dashboard.component.html', + styleUrls: ['./dashboard.component.scss'] }) export class DashboardComponent implements OnInit { - constructor() { } + constructor() { } - ngOnInit() { - } + ngOnInit() { + } } diff --git a/Display/src/app/components/laundry/laundry.component.html b/Display/src/app/components/laundry/laundry.component.html index 632f868..cebf271 100644 --- a/Display/src/app/components/laundry/laundry.component.html +++ b/Display/src/app/components/laundry/laundry.component.html @@ -22,3 +22,4 @@ + diff --git a/Display/src/app/components/laundry/laundry.component.scss b/Display/src/app/components/laundry/laundry.component.scss index ebc56b3..52fa7a3 100644 --- a/Display/src/app/components/laundry/laundry.component.scss +++ b/Display/src/app/components/laundry/laundry.component.scss @@ -1,17 +1,17 @@ .laundry-current { - font-size: 14px; + font-size: 14px; } .laundry-current-header { - font-weight: 500; - text-align: right; - padding-right: 10px; + font-weight: 500; + text-align: right; + padding-right: 10px; } .true { - color: darkgoldenrod; + color: darkgoldenrod; } .false { - color: darkgreen; + color: darkgreen; } diff --git a/Display/src/app/components/laundry/laundry.component.spec.ts b/Display/src/app/components/laundry/laundry.component.spec.ts index 9e8ec11..91ea118 100644 --- a/Display/src/app/components/laundry/laundry.component.spec.ts +++ b/Display/src/app/components/laundry/laundry.component.spec.ts @@ -3,23 +3,23 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { LaundryComponent } from './laundry.component'; describe('LaundryComponent', () => { - let component: LaundryComponent; - let fixture: ComponentFixture; + let component: LaundryComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ LaundryComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [LaundryComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(LaundryComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(LaundryComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/Display/src/app/components/laundry/laundry.component.ts b/Display/src/app/components/laundry/laundry.component.ts index 9ef090d..66c9eb1 100644 --- a/Display/src/app/components/laundry/laundry.component.ts +++ b/Display/src/app/components/laundry/laundry.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { LaundryService } from '../../services/laundry/laundry.service'; -import { LaundryStatus } from '../../services/laundry/laundry-status'; +import { LaundryStatus } from '../../models/laundry/laundry-status'; @Component({ selector: 'app-laundry', diff --git a/Display/src/app/components/nav/nav.component.scss b/Display/src/app/components/nav/nav.component.scss index 8813acf..51a8876 100644 --- a/Display/src/app/components/nav/nav.component.scss +++ b/Display/src/app/components/nav/nav.component.scss @@ -17,5 +17,5 @@ } .mat-sidenav-content { - padding: 20px; + padding: 20px; } diff --git a/Display/src/app/components/nav/nav.component.spec.ts b/Display/src/app/components/nav/nav.component.spec.ts index f27b53d..6e95c5c 100644 --- a/Display/src/app/components/nav/nav.component.spec.ts +++ b/Display/src/app/components/nav/nav.component.spec.ts @@ -10,31 +10,31 @@ import { MatToolbarModule } from '@angular/material/toolbar'; import { NavComponent } from './nav.component'; describe('NavComponent', () => { - let component: NavComponent; - let fixture: ComponentFixture; + let component: NavComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [NavComponent], - imports: [ - NoopAnimationsModule, - LayoutModule, - MatButtonModule, - MatIconModule, - MatListModule, - MatSidenavModule, - MatToolbarModule, - ] - }).compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [NavComponent], + imports: [ + NoopAnimationsModule, + LayoutModule, + MatButtonModule, + MatIconModule, + MatListModule, + MatSidenavModule, + MatToolbarModule, + ] + }).compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(NavComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(NavComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should compile', () => { - expect(component).toBeTruthy(); - }); + it('should compile', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/Display/src/app/components/nav/nav.component.ts b/Display/src/app/components/nav/nav.component.ts index 5ba8c07..adecd5d 100644 --- a/Display/src/app/components/nav/nav.component.ts +++ b/Display/src/app/components/nav/nav.component.ts @@ -4,18 +4,16 @@ import { Observable } from 'rxjs'; import { map, shareReplay } from 'rxjs/operators'; @Component({ - selector: 'app-nav', - templateUrl: './nav.component.html', - styleUrls: ['./nav.component.scss'] + selector: 'app-nav', + templateUrl: './nav.component.html', + styleUrls: ['./nav.component.scss'] }) export class NavComponent { + isHandset$: Observable = this.breakpointObserver.observe(Breakpoints.Handset) + .pipe( + map(result => result.matches), + shareReplay() + ); - isHandset$: Observable = this.breakpointObserver.observe(Breakpoints.Handset) - .pipe( - map(result => result.matches), - shareReplay() - ); - - constructor(private breakpointObserver: BreakpointObserver) {} - + constructor(private breakpointObserver: BreakpointObserver) { } } diff --git a/Display/src/app/components/weather/charts/weather-charts.component.scss b/Display/src/app/components/weather/charts/weather-charts.component.scss index dd9ea14..11a6976 100644 --- a/Display/src/app/components/weather/charts/weather-charts.component.scss +++ b/Display/src/app/components/weather/charts/weather-charts.component.scss @@ -7,18 +7,18 @@ } #chart { - position: absolute; - top: 50px; - bottom: 0; - left: 0; - right: 0; - } + position: absolute; + top: 50px; + bottom: 0; + left: 0; + right: 0; +} .chart-header { - background-color: rgb(250, 250, 250); - height: 50px; + background-color: rgb(250, 250, 250); + height: 50px; } .chart-button-spacer { - margin-right: 20px; + margin-right: 20px; } diff --git a/Display/src/app/components/weather/charts/weather-charts.component.spec.ts b/Display/src/app/components/weather/charts/weather-charts.component.spec.ts index 4b00c1d..0c9766f 100644 --- a/Display/src/app/components/weather/charts/weather-charts.component.spec.ts +++ b/Display/src/app/components/weather/charts/weather-charts.component.spec.ts @@ -3,23 +3,23 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { WeatherChartsComponent } from './weather-charts.component'; describe('WeatherChartsComponent', () => { - let component: WeatherChartsComponent; - let fixture: ComponentFixture; + let component: WeatherChartsComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ WeatherChartsComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [WeatherChartsComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(WeatherChartsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(WeatherChartsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/Display/src/app/components/weather/charts/weather-charts.component.ts b/Display/src/app/components/weather/charts/weather-charts.component.ts index d27deed..8c34ba1 100644 --- a/Display/src/app/components/weather/charts/weather-charts.component.ts +++ b/Display/src/app/components/weather/charts/weather-charts.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { Chart } from 'angular-highcharts'; import { SeriesLineOptions } from 'highcharts'; import { HttpClient } from '@angular/common/http'; -import { WeatherValue } from '../../../services/weather/weather-value'; +import { WeatherValue } from '../../../models/weather/weather-value'; import { ActivatedRoute, ParamMap } from '@angular/router'; import * as moment from 'moment'; diff --git a/Display/src/app/components/weather/current/weather-current.component.scss b/Display/src/app/components/weather/current/weather-current.component.scss index 57d8551..3f683af 100644 --- a/Display/src/app/components/weather/current/weather-current.component.scss +++ b/Display/src/app/components/weather/current/weather-current.component.scss @@ -1,9 +1,9 @@ .weather-current { - font-size: 14px; + font-size: 14px; } .weather-current-header { - font-weight: 500; - text-align: right; - padding-right: 10px; + font-weight: 500; + text-align: right; + padding-right: 10px; } diff --git a/Display/src/app/components/weather/current/weather-current.component.spec.ts b/Display/src/app/components/weather/current/weather-current.component.spec.ts index 371d9af..4bcf722 100644 --- a/Display/src/app/components/weather/current/weather-current.component.spec.ts +++ b/Display/src/app/components/weather/current/weather-current.component.spec.ts @@ -3,23 +3,23 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { WeatherCurrentComponent } from './weather-current.component'; describe('WeatherCurrentComponent', () => { - let component: WeatherCurrentComponent; - let fixture: ComponentFixture; + let component: WeatherCurrentComponent; + let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ WeatherCurrentComponent ] - }) - .compileComponents(); - })); + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [WeatherCurrentComponent] + }) + .compileComponents(); + })); - beforeEach(() => { - fixture = TestBed.createComponent(WeatherCurrentComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + beforeEach(() => { + fixture = TestBed.createComponent(WeatherCurrentComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/Display/src/app/components/weather/current/weather-current.component.ts b/Display/src/app/components/weather/current/weather-current.component.ts index cd2349b..e61a243 100644 --- a/Display/src/app/components/weather/current/weather-current.component.ts +++ b/Display/src/app/components/weather/current/weather-current.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { WeatherReading } from '../../../services/weather/weather-reading'; +import { WeatherReading } from '../../../models/weather/weather-reading'; import { WeatherService } from '../../../services/weather/weather.service'; @Component({ diff --git a/Display/src/app/models/laundry/laundry-status.spec.ts b/Display/src/app/models/laundry/laundry-status.spec.ts new file mode 100644 index 0000000..c450d68 --- /dev/null +++ b/Display/src/app/models/laundry/laundry-status.spec.ts @@ -0,0 +1,7 @@ +import { LaundryStatus } from './laundry-status'; + +describe('LaundryStatus', () => { + it('should create an instance', () => { + expect(new LaundryStatus()).toBeTruthy(); + }); +}); diff --git a/Display/src/app/services/laundry/laundry-status.ts b/Display/src/app/models/laundry/laundry-status.ts similarity index 100% rename from Display/src/app/services/laundry/laundry-status.ts rename to Display/src/app/models/laundry/laundry-status.ts diff --git a/Display/src/app/models/weather/weather-reading.spec.ts b/Display/src/app/models/weather/weather-reading.spec.ts new file mode 100644 index 0000000..fe94efa --- /dev/null +++ b/Display/src/app/models/weather/weather-reading.spec.ts @@ -0,0 +1,7 @@ +import { WeatherReading } from './weather-reading'; + +describe('WeatherReading', () => { + it('should create an instance', () => { + expect(new WeatherReading()).toBeTruthy(); + }); +}); diff --git a/Display/src/app/services/weather/weather-reading.ts b/Display/src/app/models/weather/weather-reading.ts similarity index 100% rename from Display/src/app/services/weather/weather-reading.ts rename to Display/src/app/models/weather/weather-reading.ts diff --git a/Display/src/app/services/weather/weather-value.ts b/Display/src/app/models/weather/weather-value.ts similarity index 100% rename from Display/src/app/services/weather/weather-value.ts rename to Display/src/app/models/weather/weather-value.ts diff --git a/Display/src/app/services/laundry/laundry-status.spec.ts b/Display/src/app/services/laundry/laundry-status.spec.ts deleted file mode 100644 index c47b033..0000000 --- a/Display/src/app/services/laundry/laundry-status.spec.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { LaundryStatus } from './laundry-status'; - -describe('LaundryStatus', () => { - it('should create an instance', () => { - expect(new LaundryStatus()).toBeTruthy(); - }); -}); diff --git a/Display/src/app/services/laundry/laundry.service.spec.ts b/Display/src/app/services/laundry/laundry.service.spec.ts index b13fabc..fafd8bd 100644 --- a/Display/src/app/services/laundry/laundry.service.spec.ts +++ b/Display/src/app/services/laundry/laundry.service.spec.ts @@ -3,10 +3,10 @@ import { TestBed } from '@angular/core/testing'; import { LaundryService } from './laundry.service'; describe('LaundryService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => TestBed.configureTestingModule({})); - it('should be created', () => { - const service: LaundryService = TestBed.get(LaundryService); - expect(service).toBeTruthy(); - }); + it('should be created', () => { + const service: LaundryService = TestBed.get(LaundryService); + expect(service).toBeTruthy(); + }); }); diff --git a/Display/src/app/services/laundry/laundry.service.ts b/Display/src/app/services/laundry/laundry.service.ts index adbcd5b..f7a1cd8 100644 --- a/Display/src/app/services/laundry/laundry.service.ts +++ b/Display/src/app/services/laundry/laundry.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, BehaviorSubject } from 'rxjs'; import { Socket } from 'ngx-socket-io'; -import { LaundryStatus } from './laundry-status'; +import { LaundryStatus } from '../../models/laundry/laundry-status'; @Injectable({ providedIn: 'root' @@ -14,11 +14,11 @@ export class LaundryService { const newStatus: LaundryStatus = JSON.parse(statusString); if (newStatus.washer !== undefined) { - this.latestStatus.value.washer = newStatus.washer; + this.latestStatus.value.washer = newStatus.washer; } if (newStatus.dryer !== undefined) { - this.latestStatus.value.dryer = newStatus.dryer; + this.latestStatus.value.dryer = newStatus.dryer; } }); diff --git a/Display/src/app/services/weather/weather-reading.spec.ts b/Display/src/app/services/weather/weather-reading.spec.ts deleted file mode 100644 index ebf4089..0000000 --- a/Display/src/app/services/weather/weather-reading.spec.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { WeatherReading } from './weather-reading'; - -describe('WeatherReading', () => { - it('should create an instance', () => { - expect(new WeatherReading()).toBeTruthy(); - }); -}); diff --git a/Display/src/app/services/weather/weather.service.spec.ts b/Display/src/app/services/weather/weather.service.spec.ts index fe5b5b3..beb2479 100644 --- a/Display/src/app/services/weather/weather.service.spec.ts +++ b/Display/src/app/services/weather/weather.service.spec.ts @@ -3,10 +3,10 @@ import { TestBed } from '@angular/core/testing'; import { WeatherService } from './weather.service'; describe('WeatherService', () => { - beforeEach(() => TestBed.configureTestingModule({})); + beforeEach(() => TestBed.configureTestingModule({})); - it('should be created', () => { - const service: WeatherService = TestBed.get(WeatherService); - expect(service).toBeTruthy(); - }); + it('should be created', () => { + const service: WeatherService = TestBed.get(WeatherService); + expect(service).toBeTruthy(); + }); }); diff --git a/Display/src/app/services/weather/weather.service.ts b/Display/src/app/services/weather/weather.service.ts index 8fd0781..88b2f7c 100644 --- a/Display/src/app/services/weather/weather.service.ts +++ b/Display/src/app/services/weather/weather.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable, BehaviorSubject } from 'rxjs'; import { HubConnectionBuilder, HubConnection } from '@aspnet/signalr'; -import { WeatherReading } from './weather-reading'; +import { WeatherReading } from '../../models/weather/weather-reading'; @Injectable({ providedIn: 'root' diff --git a/Display/src/test.ts b/Display/src/test.ts index 1631789..1c2f3fc 100644 --- a/Display/src/test.ts +++ b/Display/src/test.ts @@ -3,16 +3,16 @@ import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting + BrowserDynamicTestingModule, + platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); diff --git a/Display/tsconfig.app.json b/Display/tsconfig.app.json index 565a11a..b7a7086 100644 --- a/Display/tsconfig.app.json +++ b/Display/tsconfig.app.json @@ -1,18 +1,18 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./out-tsc/app", - "types": [] - }, - "files": [ - "src/main.ts", - "src/polyfills.ts" - ], - "include": [ - "src/**/*.ts" - ], - "exclude": [ - "src/test.ts", - "src/**/*.spec.ts" - ] + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": [ + "src/main.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "src/test.ts", + "src/**/*.spec.ts" + ] } diff --git a/Display/tsconfig.json b/Display/tsconfig.json index 30956ae..417de3c 100644 --- a/Display/tsconfig.json +++ b/Display/tsconfig.json @@ -1,26 +1,26 @@ { - "compileOnSave": false, - "compilerOptions": { - "baseUrl": "./", - "outDir": "./dist/out-tsc", - "sourceMap": true, - "declaration": false, - "downlevelIteration": true, - "experimentalDecorators": true, - "module": "esnext", - "moduleResolution": "node", - "importHelpers": true, - "target": "es2015", - "typeRoots": [ - "node_modules/@types" - ], - "lib": [ - "es2018", - "dom" - ] - }, - "angularCompilerOptions": { - "fullTemplateTypeCheck": true, - "strictInjectionParameters": true - } + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "module": "esnext", + "moduleResolution": "node", + "importHelpers": true, + "target": "es2015", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2018", + "dom" + ] + }, + "angularCompilerOptions": { + "fullTemplateTypeCheck": true, + "strictInjectionParameters": true + } } diff --git a/Display/tsconfig.spec.json b/Display/tsconfig.spec.json index 6400fde..f3d7d22 100644 --- a/Display/tsconfig.spec.json +++ b/Display/tsconfig.spec.json @@ -1,18 +1,18 @@ { - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./out-tsc/spec", - "types": [ - "jasmine", - "node" + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/spec", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "src/test.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.spec.ts", + "src/**/*.d.ts" ] - }, - "files": [ - "src/test.ts", - "src/polyfills.ts" - ], - "include": [ - "src/**/*.spec.ts", - "src/**/*.d.ts" - ] } diff --git a/Display/tslint.json b/Display/tslint.json index b8dd260..7b987d8 100644 --- a/Display/tslint.json +++ b/Display/tslint.json @@ -1,91 +1,91 @@ { - "extends": "tslint:recommended", - "rules": { - "array-type": false, - "arrow-parens": false, - "deprecation": { - "severity": "warning" + "extends": "tslint:recommended", + "rules": { + "array-type": false, + "arrow-parens": false, + "deprecation": { + "severity": "warning" + }, + "component-class-suffix": true, + "contextual-lifecycle": true, + "directive-class-suffix": true, + "directive-selector": [ + true, + "attribute", + "app", + "camelCase" + ], + "component-selector": [ + true, + "element", + "app", + "kebab-case" + ], + "import-blacklist": [ + true, + "rxjs/Rx" + ], + "interface-name": false, + "max-classes-per-file": false, + "max-line-length": [ + false + ], + "member-access": false, + "member-ordering": [ + true, + { + "order": [ + "static-field", + "instance-field", + "static-method", + "instance-method" + ] + } + ], + "no-consecutive-blank-lines": false, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-empty": false, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-non-null-assertion": true, + "no-redundant-jsdoc": true, + "no-switch-case-fall-through": true, + "no-use-before-declare": true, + "no-var-requires": false, + "object-literal-key-quotes": [ + true, + "as-needed" + ], + "object-literal-sort-keys": false, + "ordered-imports": false, + "quotemark": [ + true, + "single" + ], + "trailing-comma": false, + "no-conflicting-lifecycle": true, + "no-host-metadata-property": true, + "no-input-rename": true, + "no-inputs-metadata-property": true, + "no-output-native": true, + "no-output-on-prefix": true, + "no-output-rename": true, + "no-outputs-metadata-property": true, + "template-banana-in-box": true, + "template-no-negated-async": true, + "use-lifecycle-interface": true, + "use-pipe-transform-interface": true }, - "component-class-suffix": true, - "contextual-lifecycle": true, - "directive-class-suffix": true, - "directive-selector": [ - true, - "attribute", - "app", - "camelCase" - ], - "component-selector": [ - true, - "element", - "app", - "kebab-case" - ], - "import-blacklist": [ - true, - "rxjs/Rx" - ], - "interface-name": false, - "max-classes-per-file": false, - "max-line-length": [ - false - ], - "member-access": false, - "member-ordering": [ - true, - { - "order": [ - "static-field", - "instance-field", - "static-method", - "instance-method" - ] - } - ], - "no-consecutive-blank-lines": false, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-empty": false, - "no-inferrable-types": [ - true, - "ignore-params" - ], - "no-non-null-assertion": true, - "no-redundant-jsdoc": true, - "no-switch-case-fall-through": true, - "no-use-before-declare": true, - "no-var-requires": false, - "object-literal-key-quotes": [ - true, - "as-needed" - ], - "object-literal-sort-keys": false, - "ordered-imports": false, - "quotemark": [ - true, - "single" - ], - "trailing-comma": false, - "no-conflicting-lifecycle": true, - "no-host-metadata-property": true, - "no-input-rename": true, - "no-inputs-metadata-property": true, - "no-output-native": true, - "no-output-on-prefix": true, - "no-output-rename": true, - "no-outputs-metadata-property": true, - "template-banana-in-box": true, - "template-no-negated-async": true, - "use-lifecycle-interface": true, - "use-pipe-transform-interface": true - }, - "rulesDirectory": [ - "codelyzer" - ] + "rulesDirectory": [ + "codelyzer" + ] }