mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-22 06:17:47 +00:00
Move MockedToasterService to spec
This commit is contained in:
parent
6a85c2754e
commit
4145581caf
@ -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', () => {
|
||||
|
@ -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;
|
||||
|
@ -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) {}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user