-
-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into parity-signer-erc681
- Loading branch information
Showing
38 changed files
with
539 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
import shapeshift, { SHAPESHIFT_BASE_URL } from './shapeshift'; | ||
|
||
describe('ShapeShift service', () => { | ||
beforeEach(() => { | ||
(global as any).fetch = jest.fn().mockImplementation( | ||
(url: string) => | ||
new Promise(resolve => { | ||
const returnValues = { | ||
[`${SHAPESHIFT_BASE_URL}/marketinfo`]: { | ||
status: 200, | ||
json: () => [ | ||
{ | ||
limit: 1, | ||
maxLimit: 2, | ||
min: 1, | ||
minerFee: 2, | ||
pair: 'BTC_ETH', | ||
rate: '1.0' | ||
}, | ||
{ | ||
limit: 1, | ||
maxLimit: 2, | ||
min: 1, | ||
minerFee: 2, | ||
pair: 'ETH_BTC', | ||
rate: '1.0' | ||
} | ||
] | ||
}, | ||
[`${SHAPESHIFT_BASE_URL}/getcoins`]: { | ||
status: 200, | ||
json: () => ({ | ||
BTC: { | ||
name: 'Bitcoin', | ||
symbol: 'BTC', | ||
image: '', | ||
imageSmall: '', | ||
status: 'available', | ||
minerFee: 1 | ||
}, | ||
ETH: { | ||
name: 'Ethereum', | ||
symbol: 'ETH', | ||
image: '', | ||
imageSmall: '', | ||
status: 'available', | ||
minerFee: 1 | ||
}, | ||
XMR: { | ||
name: 'Monero', | ||
symbol: 'XMR', | ||
image: '', | ||
imageSmall: '', | ||
status: 'unavailable', | ||
minerFee: 1 | ||
} | ||
}) | ||
} | ||
}; | ||
|
||
resolve(returnValues[url]); | ||
}) | ||
); | ||
}); | ||
it('provides a collection of all available and unavailable coins and tokens', async done => { | ||
const rates = await shapeshift.getAllRates(); | ||
|
||
expect(rates).toEqual({ | ||
BTCETH: { | ||
id: 'BTCETH', | ||
rate: '1.0', | ||
limit: 1, | ||
min: 1, | ||
options: [ | ||
{ | ||
id: 'BTC', | ||
image: '', | ||
name: 'Bitcoin', | ||
status: 'available' | ||
}, | ||
{ | ||
id: 'ETH', | ||
image: '', | ||
name: 'Ethereum', | ||
status: 'available' | ||
} | ||
] | ||
}, | ||
ETHBTC: { | ||
id: 'ETHBTC', | ||
rate: '1.0', | ||
limit: 1, | ||
min: 1, | ||
options: [ | ||
{ | ||
id: 'ETH', | ||
image: '', | ||
name: 'Ethereum', | ||
status: 'available' | ||
}, | ||
{ | ||
id: 'BTC', | ||
image: '', | ||
name: 'Bitcoin', | ||
status: 'available' | ||
} | ||
] | ||
}, | ||
__XMR: { | ||
id: '__XMR', | ||
limit: 0, | ||
min: 0, | ||
options: [ | ||
{ | ||
id: 'XMR', | ||
image: '', | ||
name: 'Monero', | ||
status: 'unavailable' | ||
} | ||
] | ||
} | ||
}); | ||
done(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.