mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-20 21:43:06 +00:00
Lock down typescript to <2.8.0 and fix tests
This commit is contained in:
parent
993084290c
commit
d641cc6ce6
@ -83,7 +83,7 @@
|
||||
"ts-mockito": "^2.3.0",
|
||||
"ts-node": "~7.0.0",
|
||||
"tslint": "~5.10.0",
|
||||
"typescript": "^2.9.2"
|
||||
"typescript": "<2.8.0"
|
||||
},
|
||||
"greenkeeper": {
|
||||
"ignore": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { TestBed, } from '@angular/core/testing';
|
||||
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
|
||||
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
|
||||
import { HttpClient, HttpErrorResponse } from "@angular/common/http";
|
||||
|
||||
import { Server } from '../models/server';
|
||||
import {HttpServer, ServerError, ServerErrorHandler} from './http-server.service';
|
||||
@ -27,22 +27,28 @@ describe('ServerError', () => {
|
||||
|
||||
|
||||
describe('ServerErrorHandler', () => {
|
||||
it('should handle HttpErrorResponse with status 0', () => {
|
||||
it('should handle HttpErrorResponse with status 0', (done) => {
|
||||
const error = new HttpErrorResponse({ status: 0 });
|
||||
|
||||
const handler = new ServerErrorHandler();
|
||||
const result = handler.handleError(error);
|
||||
|
||||
expect(result.error.message).toEqual('Server is unreachable');
|
||||
result.subscribe(null, (err) => {
|
||||
expect(err.message).toEqual('Server is unreachable');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should not handle HttpErrorResponse with status!=0', () => {
|
||||
it('should not handle HttpErrorResponse with status!=0', (done) => {
|
||||
const error = new HttpErrorResponse({ status: 499 });
|
||||
|
||||
const handler = new ServerErrorHandler();
|
||||
const result = handler.handleError(error);
|
||||
|
||||
expect(result.error.message).toEqual('Http failure response for (unknown url): 499 undefined');
|
||||
result.subscribe(null, (err) => {
|
||||
expect(err.message).toEqual('Http failure response for (unknown url): 499 undefined');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpHeaders, HttpClient, HttpParams, HttpErrorResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import {Server} from "../models/server";
|
||||
import { Observable, throwError } from 'rxjs';
|
||||
import { catchError } from "rxjs/operators";
|
||||
|
||||
import 'rxjs/add/observable/throw'
|
||||
import {Server} from "../models/server";
|
||||
|
||||
|
||||
/* tslint:disable:interface-over-type-literal */
|
||||
@ -66,7 +65,7 @@ export class ServerErrorHandler {
|
||||
err = ServerError.fromError("Server is unreachable", error);
|
||||
}
|
||||
|
||||
return Observable.throw(err);
|
||||
return throwError(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -433,10 +433,6 @@
|
||||
version "2.8.8"
|
||||
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.8.tgz#bf53a7d193ea8b03867a38bfdb4fbb0e0bf066c9"
|
||||
|
||||
"@types/jasmine@~2.8.8":
|
||||
version "2.8.8"
|
||||
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.8.8.tgz#bf53a7d193ea8b03867a38bfdb4fbb0e0bf066c9"
|
||||
|
||||
"@types/jasminewd2@~2.0.2":
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/jasminewd2/-/jasminewd2-2.0.3.tgz#0d2886b0cbdae4c0eeba55e30792f584bf040a95"
|
||||
@ -8167,11 +8163,11 @@ typeface-roboto@^0.0.54:
|
||||
version "0.0.54"
|
||||
resolved "https://registry.yarnpkg.com/typeface-roboto/-/typeface-roboto-0.0.54.tgz#8f02c9a18d1cfa7f49381a6ff0d21ff061f38ad2"
|
||||
|
||||
"typescript@>=2.6.2 <2.8":
|
||||
typescript@<2.8.0, "typescript@>=2.6.2 <2.8":
|
||||
version "2.7.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836"
|
||||
|
||||
typescript@^2.9.2, typescript@~2.9.1:
|
||||
typescript@~2.9.1:
|
||||
version "2.9.2"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user