fixed lint warnings and tests
This commit is contained in:
parent
1dfe384271
commit
2226a2cc18
@ -2,6 +2,7 @@
|
|||||||
import { TestBed, ComponentFixture, inject } from '@angular/core/testing';
|
import { TestBed, ComponentFixture, inject } from '@angular/core/testing';
|
||||||
import { HttpModule } from '@angular/http';
|
import { HttpModule } from '@angular/http';
|
||||||
import { CurrencyProvider } from './currency';
|
import { CurrencyProvider } from './currency';
|
||||||
|
import { ApiProvider } from '../api/api';
|
||||||
|
|
||||||
describe('CurrencyProvider', () => {
|
describe('CurrencyProvider', () => {
|
||||||
let currency: CurrencyProvider;
|
let currency: CurrencyProvider;
|
||||||
@ -12,6 +13,7 @@ describe('CurrencyProvider', () => {
|
|||||||
HttpModule
|
HttpModule
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
|
ApiProvider,
|
||||||
CurrencyProvider
|
CurrencyProvider
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@ -12,9 +12,9 @@ import 'rxjs/add/operator/map';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
export class CurrencyProvider {
|
export class CurrencyProvider {
|
||||||
|
|
||||||
private defaultCurrency: string;
|
public defaultCurrency: string;
|
||||||
private currencySymbol: string;
|
public currencySymbol: string;
|
||||||
private factor: number = 1;
|
public factor: number = 1;
|
||||||
private bitstamp: number;
|
private bitstamp: number;
|
||||||
private loading: boolean;
|
private loading: boolean;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ export class CurrencyProvider {
|
|||||||
this.currencySymbol = this.defaultCurrency;
|
this.currencySymbol = this.defaultCurrency;
|
||||||
}
|
}
|
||||||
|
|
||||||
private roundFloat(aFloat: number, decimalPlaces: number): number {
|
public roundFloat(aFloat: number, decimalPlaces: number): number {
|
||||||
return Math.round(aFloat * Math.pow(10, decimalPlaces)) / Math.pow(10, decimalPlaces);
|
return Math.round(aFloat * Math.pow(10, decimalPlaces)) / Math.pow(10, decimalPlaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ export class CurrencyProvider {
|
|||||||
if (currency === 'USD') {
|
if (currency === 'USD') {
|
||||||
this.http.get(this.api.apiPrefix + 'currency').subscribe(
|
this.http.get(this.api.apiPrefix + 'currency').subscribe(
|
||||||
(data) => {
|
(data) => {
|
||||||
let currencyParsed = JSON.parse(data['_body']);
|
let currencyParsed: any = JSON.parse(data['_body']);
|
||||||
this.factor = this.bitstamp = currencyParsed.data.bitstamp;
|
this.factor = this.bitstamp = currencyParsed.data.bitstamp;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user