Move MockedToasterService to spec

This commit is contained in:
ziajka 2018-06-27 10:23:04 +02:00
parent 6a85c2754e
commit 4145581caf
4 changed files with 31 additions and 29 deletions

View File

@ -7,10 +7,7 @@ import { HotkeyModule, HotkeysService, Hotkey } from "angular2-hotkeys";
import { Observable } from "rxjs";
import { ProjectMapShortcutsComponent } from './project-map-shortcuts.component';
import {
ToasterService,
MockedToasterService
} from "../../shared/services/toaster.service";
import { ToasterService, } from "../../shared/services/toaster.service";
import { NodeService } from "../../shared/services/node.service";
import { HttpServer } from "../../shared/services/http-server.service";
import { SelectionManager } from "../../cartography/shared/managers/selection-manager";
@ -20,6 +17,7 @@ import { Project } from "../../shared/models/project";
import { ProjectService } from "../../shared/services/project.service";
import { MockedProjectService } from "../../shared/services/project.service.spec";
import { SettingsService } from "../../shared/services/settings.service";
import { MockedToasterService } from "../../shared/services/toaster.service.spec";
describe('ProjectMapShortcutsComponent', () => {

View File

@ -1,12 +1,15 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingsComponent } from './settings.component';
import { MatCheckboxModule, MatExpansionModule } from "@angular/material";
import { FormsModule } from "@angular/forms";
import { SettingsService } from "../shared/services/settings.service";
import { PersistenceModule } from "angular-persistence";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { MockedToasterService, ToasterService } from "../shared/services/toaster.service";
import { PersistenceModule } from "angular-persistence";
import { SettingsComponent } from './settings.component';
import { SettingsService } from "../shared/services/settings.service";
import { ToasterService } from "../shared/services/toaster.service";
import { MockedToasterService } from "../shared/services/toaster.service.spec";
describe('SettingsComponent', () => {
let component: SettingsComponent;

View File

@ -1,7 +1,27 @@
import { TestBed, inject } from '@angular/core/testing';
import { MatSnackBar } from '@angular/material';
import { ToasterService } from './toaster.service';
import { MatSnackBar } from '@angular/material';
export class MockedToasterService {
public errors: string[];
public successes: string[];
constructor() {
this.errors = [];
this.successes = [];
}
public error(message: string) {
this.errors.push(message);
}
public success(message: string) {
this.successes.push(message);
}
}
class MockedSnackBar {
public open(message: string, ignored: any, options: any) {}

View File

@ -14,22 +14,3 @@ export class ToasterService {
}
}
@Injectable()
export class MockedToasterService {
public errors: string[];
public successes: string[];
constructor() {
this.errors = [];
this.successes = [];
}
public error(message: string) {
this.errors.push(message);
}
public success(message: string) {
this.successes.push(message);
}
}