Skip to content

Commit

Permalink
fix tests for travis
Browse files Browse the repository at this point in the history
  • Loading branch information
schnogz committed May 7, 2018
1 parent 47fa25a commit b321d7a
Showing 1 changed file with 7 additions and 9 deletions.
Expand Up @@ -65,15 +65,13 @@ describe('ShapeshiftService Service', () => {

describe('formatTrade()', () => {
let dateNowSpy
let fakeTimestamp = 1517443202000
let fakeTimeFormatted = '31 January 2018, 19:00'
let fakeTimestamp = 1517443101000
let mockTrade = {
timestamp: fakeTimestamp,
quote: { pair: 'btc_eth' }
}

beforeAll(() => {
// lock Time to 1/1/2018
dateNowSpy = jest.spyOn(Date, 'now').mockImplementation(() => fakeTimestamp)
})

Expand All @@ -85,7 +83,7 @@ describe('ShapeshiftService Service', () => {
it('should return correct formatted trades for btc_eth pair', () => {
mockTrade.quote.pair = 'btc_eth'
expect(ShapeshiftService.formatTrade(mockTrade)).toEqual({
date: fakeTimeFormatted,
date: expect.any(String),
quote: { pair: 'btc_eth' },
sourceCoin: 'BTC',
targetCoin: 'ETH',
Expand All @@ -96,7 +94,7 @@ describe('ShapeshiftService Service', () => {
it('should return correct formatted trades for btc_bch pair', () => {
mockTrade.quote.pair = 'btc_bch'
expect(ShapeshiftService.formatTrade(mockTrade)).toEqual({
date: fakeTimeFormatted,
date: expect.any(String),
quote: { pair: 'btc_bch' },
sourceCoin: 'BTC',
targetCoin: 'BCH',
Expand All @@ -107,7 +105,7 @@ describe('ShapeshiftService Service', () => {
it('should return correct formatted trades for bch_btc pair', () => {
mockTrade.quote.pair = 'bch_btc'
expect(ShapeshiftService.formatTrade(mockTrade)).toEqual({
date: fakeTimeFormatted,
date: expect.any(String),
quote: { pair: 'bch_btc' },
sourceCoin: 'BCH',
targetCoin: 'BTC',
Expand All @@ -118,7 +116,7 @@ describe('ShapeshiftService Service', () => {
it('should return correct formatted trades for bch_eth pair', () => {
mockTrade.quote.pair = 'bch_eth'
expect(ShapeshiftService.formatTrade(mockTrade)).toEqual({
date: fakeTimeFormatted,
date: expect.any(String),
quote: { pair: 'bch_eth' },
sourceCoin: 'BCH',
targetCoin: 'ETH',
Expand All @@ -129,7 +127,7 @@ describe('ShapeshiftService Service', () => {
it('should return correct formatted trades for eth_btc pair', () => {
mockTrade.quote.pair = 'eth_btc'
expect(ShapeshiftService.formatTrade(mockTrade)).toEqual({
date: fakeTimeFormatted,
date: expect.any(String),
quote: { pair: 'eth_btc' },
sourceCoin: 'ETH',
targetCoin: 'BTC',
Expand All @@ -140,7 +138,7 @@ describe('ShapeshiftService Service', () => {
it('should return correct formatted trades for eth_bch pair', () => {
mockTrade.quote.pair = 'eth_bch'
expect(ShapeshiftService.formatTrade(mockTrade)).toEqual({
date: fakeTimeFormatted,
date: expect.any(String),
quote: { pair: 'eth_bch' },
sourceCoin: 'ETH',
targetCoin: 'BCH',
Expand Down

0 comments on commit b321d7a

Please sign in to comment.