aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/test
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-10-27 06:32:04 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-10-27 06:45:17 +0800
commit4f5ab1a72d33dc6a7516d7b1d51f1aa15752a6b8 (patch)
treebf3766ecf6ea51c6dfcd1d286c572b3410088087 /packages/instant/test
parent51da5311b54733540f44f938a0c953bb4ae42052 (diff)
downloaddexon-0x-contracts-4f5ab1a72d33dc6a7516d7b1d51f1aa15752a6b8.tar
dexon-0x-contracts-4f5ab1a72d33dc6a7516d7b1d51f1aa15752a6b8.tar.gz
dexon-0x-contracts-4f5ab1a72d33dc6a7516d7b1d51f1aa15752a6b8.tar.bz2
dexon-0x-contracts-4f5ab1a72d33dc6a7516d7b1d51f1aa15752a6b8.tar.lz
dexon-0x-contracts-4f5ab1a72d33dc6a7516d7b1d51f1aa15752a6b8.tar.xz
dexon-0x-contracts-4f5ab1a72d33dc6a7516d7b1d51f1aa15752a6b8.tar.zst
dexon-0x-contracts-4f5ab1a72d33dc6a7516d7b1d51f1aa15752a6b8.zip
Refactor error handling such that errorMessage lives on the top level state
Diffstat (limited to 'packages/instant/test')
-rw-r--r--packages/instant/test/util/error.test.ts56
1 files changed, 0 insertions, 56 deletions
diff --git a/packages/instant/test/util/error.test.ts b/packages/instant/test/util/error.test.ts
deleted file mode 100644
index 90e9c5fb4..000000000
--- a/packages/instant/test/util/error.test.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-import { AssetBuyerError } from '@0x/asset-buyer';
-import { AssetProxyId } from '@0x/types';
-
-import { Asset } from '../../src/types';
-import { errorUtil } from '../../src/util/error';
-
-const ZRX_ASSET_DATA = '0xf47261b0000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f498';
-const ZRX_ASSET: Asset = {
- assetData: ZRX_ASSET_DATA,
- metaData: {
- assetProxyId: AssetProxyId.ERC20,
- symbol: 'zrx',
- decimals: 18,
- },
-};
-
-describe('errorUtil', () => {
- describe('errorFlasher', () => {
- it('should return error and asset name for InsufficientAssetLiquidity', () => {
- const insufficientAssetError = new Error(AssetBuyerError.InsufficientAssetLiquidity);
- expect(errorUtil.errorDescription(insufficientAssetError, ZRX_ASSET).message).toEqual(
- 'Not enough ZRX available',
- );
- });
- it('should return error default name for InsufficientAssetLiquidity', () => {
- const insufficientZrxError = new Error(AssetBuyerError.InsufficientZrxLiquidity);
- expect(errorUtil.errorDescription(insufficientZrxError).message).toEqual(
- 'Not enough of this asset available',
- );
- });
- it('should return asset name for InsufficientAssetLiquidity', () => {
- const insufficientZrxError = new Error(AssetBuyerError.InsufficientZrxLiquidity);
- expect(errorUtil.errorDescription(insufficientZrxError, ZRX_ASSET).message).toEqual(
- 'Not enough ZRX available',
- );
- });
- it('should return unavailable error and asset name for StandardRelayerApiError', () => {
- const standardRelayerError = new Error(AssetBuyerError.StandardRelayerApiError);
- expect(errorUtil.errorDescription(standardRelayerError, ZRX_ASSET).message).toEqual(
- 'ZRX is currently unavailable',
- );
- });
- it('should return error for AssetUnavailable error', () => {
- const assetUnavailableError = new Error(`${AssetBuyerError.AssetUnavailable}: For assetData ${ZRX_ASSET}`);
- expect(errorUtil.errorDescription(assetUnavailableError, ZRX_ASSET).message).toEqual(
- 'ZRX is currently unavailable',
- );
- });
- it('should return default for AssetUnavailable error', () => {
- const assetUnavailableError = new Error(`${AssetBuyerError.AssetUnavailable}: For assetData xyz`);
- expect(errorUtil.errorDescription(assetUnavailableError, undefined).message).toEqual(
- 'This asset is currently unavailable',
- );
- });
- });
-});