Fixes broken unit tests. Updates sartography-workflow-lib.

This commit is contained in:
Aaron Louie 2020-02-24 16:43:03 -05:00
parent fe1a481f43
commit d39e414962
6 changed files with 54 additions and 9 deletions

6
package-lock.json generated
View File

@ -11641,9 +11641,9 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"sartography-workflow-lib": {
"version": "0.0.46",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.46.tgz",
"integrity": "sha512-gxm3mfSyQ/g9Axen4w0HAH+s3mQARVANN5KfPQZgSnvT1wP/ymnhZDikg/hfbUJQZ5qwMv+phKK53HeAsexU3w==",
"version": "0.0.48",
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.48.tgz",
"integrity": "sha512-HeqzSbbt5J9S3FulBCUEYogXIRPkkTwnhViaxd6zEzpMDebZEt6FMCBXjVZ8e+x0griL66RNCvWzh4EXRmOkqA==",
"requires": {
"tslib": "^1.9.0"
}

View File

@ -47,7 +47,7 @@
"file-saver": "^2.0.2",
"hammerjs": "^2.0.8",
"rxjs": "~6.5.4",
"sartography-workflow-lib": "^0.0.46",
"sartography-workflow-lib": "^0.0.48",
"tslib": "^1.10.0",
"uuid": "^3.4.0",
"zone.js": "~0.9.1"

View File

@ -0,0 +1,7 @@
#globalHeader {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 2;
}

View File

@ -1,8 +1,12 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {MatIconModule} from '@angular/material/icon';
import {MatMenuModule} from '@angular/material/menu';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {RouterTestingModule} from '@angular/router/testing';
import {AppComponent} from './app.component';
import {FooterComponent} from './footer/footer.component';
import {NavbarComponent} from './navbar/navbar.component';
describe('AppComponent', () => {
let component: AppComponent;
@ -10,9 +14,15 @@ describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AppComponent],
declarations: [
AppComponent,
FooterComponent,
NavbarComponent
],
imports: [
BrowserAnimationsModule,
MatIconModule,
MatMenuModule,
RouterTestingModule,
]
})

View File

@ -1,6 +1,21 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {Component, NO_ERRORS_SCHEMA} from '@angular/core';
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {MockEnvironment} from 'sartography-workflow-lib';
import { HomeComponent } from './home.component';
import {HomeComponent} from './home.component';
@Component({
selector: 'app-sign-in',
template: ''
})
class MockSignInComponent {}
@Component({
selector: 'app-workflow-spec-list',
template: ''
})
class MockWorkflowSpecListComponent {}
describe('HomeComponent', () => {
let component: HomeComponent;
@ -8,7 +23,11 @@ describe('HomeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ HomeComponent ]
declarations: [
HomeComponent,
MockSignInComponent,
MockWorkflowSpecListComponent,
],
})
.compileComponents();
}));
@ -22,4 +41,10 @@ describe('HomeComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
it('should check signed-in state', () => {
const result = component.isSignedIn();
expect(result).toBeDefined();
expect(typeof result).toEqual('boolean');
});
});

View File

@ -1,3 +1,4 @@
import {PlatformLocation} from '@angular/common';
import {Component, Inject, OnInit} from '@angular/core';
import {FormGroup} from '@angular/forms';
import {Router} from '@angular/router';
@ -56,7 +57,8 @@ export class SignInComponent implements OnInit {
constructor(
@Inject('APP_ENVIRONMENT') private environment: AppEnvironment,
private router: Router,
private api: ApiService
private api: ApiService,
private platformLocation: PlatformLocation
) {
}
@ -70,6 +72,7 @@ export class SignInComponent implements OnInit {
// For testing purposes, create a user to simulate login.
if (!this.environment.production) {
this.model.redirect_url = this.platformLocation.href + 'session';
this.api.openSession(this.model);
} else {
this.error = new Error('This feature does not work in production.');