diff --git a/app/src/providers/currency/currency.spec.ts b/app/src/providers/currency/currency.spec.ts index 2170c01..02fa17a 100644 --- a/app/src/providers/currency/currency.spec.ts +++ b/app/src/providers/currency/currency.spec.ts @@ -2,6 +2,7 @@ import { TestBed, ComponentFixture, inject } from '@angular/core/testing'; import { HttpModule } from '@angular/http'; import { CurrencyProvider } from './currency'; +import { ApiProvider } from '../api/api'; describe('CurrencyProvider', () => { let currency: CurrencyProvider; @@ -12,6 +13,7 @@ describe('CurrencyProvider', () => { HttpModule ], providers: [ + ApiProvider, CurrencyProvider ] }); diff --git a/app/src/providers/currency/currency.ts b/app/src/providers/currency/currency.ts index b89d2ff..b3f571b 100644 --- a/app/src/providers/currency/currency.ts +++ b/app/src/providers/currency/currency.ts @@ -12,9 +12,9 @@ import 'rxjs/add/operator/map'; @Injectable() export class CurrencyProvider { - private defaultCurrency: string; - private currencySymbol: string; - private factor: number = 1; + public defaultCurrency: string; + public currencySymbol: string; + public factor: number = 1; private bitstamp: number; private loading: boolean; @@ -23,7 +23,7 @@ export class CurrencyProvider { 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); } @@ -55,7 +55,7 @@ export class CurrencyProvider { if (currency === 'USD') { this.http.get(this.api.apiPrefix + 'currency').subscribe( (data) => { - let currencyParsed = JSON.parse(data['_body']); + let currencyParsed: any = JSON.parse(data['_body']); this.factor = this.bitstamp = currencyParsed.data.bitstamp; this.loading = false; },