Refactoring

This commit is contained in:
2019-09-30 17:54:47 -04:00
parent 89df5efe5a
commit 5b64470d1f
35 changed files with 484 additions and 485 deletions

View File

@@ -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!');
});
});

View File

@@ -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';
}

View File

@@ -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<DashboardComponent>;
let component: DashboardComponent;
let fixture: ComponentFixture<DashboardComponent>;
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();
});
});

View File

@@ -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() {
}
}

View File

@@ -22,3 +22,4 @@
</tr>
</table>
</div>
</div>

View File

@@ -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;
}

View File

@@ -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<LaundryComponent>;
let component: LaundryComponent;
let fixture: ComponentFixture<LaundryComponent>;
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();
});
});

View File

@@ -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',

View File

@@ -17,5 +17,5 @@
}
.mat-sidenav-content {
padding: 20px;
padding: 20px;
}

View File

@@ -10,31 +10,31 @@ import { MatToolbarModule } from '@angular/material/toolbar';
import { NavComponent } from './nav.component';
describe('NavComponent', () => {
let component: NavComponent;
let fixture: ComponentFixture<NavComponent>;
let component: NavComponent;
let fixture: ComponentFixture<NavComponent>;
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();
});
});

View File

@@ -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<boolean> = this.breakpointObserver.observe(Breakpoints.Handset)
.pipe(
map(result => result.matches),
shareReplay()
);
isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset)
.pipe(
map(result => result.matches),
shareReplay()
);
constructor(private breakpointObserver: BreakpointObserver) {}
constructor(private breakpointObserver: BreakpointObserver) { }
}

View File

@@ -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;
}

View File

@@ -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<WeatherChartsComponent>;
let component: WeatherChartsComponent;
let fixture: ComponentFixture<WeatherChartsComponent>;
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();
});
});

View File

@@ -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';

View File

@@ -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;
}

View File

@@ -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<WeatherCurrentComponent>;
let component: WeatherCurrentComponent;
let fixture: ComponentFixture<WeatherCurrentComponent>;
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();
});
});

View File

@@ -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({

View File

@@ -0,0 +1,7 @@
import { LaundryStatus } from './laundry-status';
describe('LaundryStatus', () => {
it('should create an instance', () => {
expect(new LaundryStatus()).toBeTruthy();
});
});

View File

@@ -0,0 +1,7 @@
import { WeatherReading } from './weather-reading';
describe('WeatherReading', () => {
it('should create an instance', () => {
expect(new WeatherReading()).toBeTruthy();
});
});

View File

@@ -1,7 +0,0 @@
import { LaundryStatus } from './laundry-status';
describe('LaundryStatus', () => {
it('should create an instance', () => {
expect(new LaundryStatus()).toBeTruthy();
});
});

View File

@@ -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();
});
});

View File

@@ -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;
}
});

View File

@@ -1,7 +0,0 @@
import { WeatherReading } from './weather-reading';
describe('WeatherReading', () => {
it('should create an instance', () => {
expect(new WeatherReading()).toBeTruthy();
});
});

View File

@@ -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();
});
});

View File

@@ -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'

View File

@@ -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$/);