Fix lint errors

Signed-off-by: James Taylor <jamest@uk.ibm.com>
This commit is contained in:
James Taylor 2021-12-13 12:11:59 +00:00
parent 5d92abc52d
commit 66199000ca
3 changed files with 24 additions and 18 deletions

View file

@ -204,7 +204,10 @@ describe('Errors', () => {
}); });
it('returns RetryAction.None for a TransactionNotFoundError', () => { it('returns RetryAction.None for a TransactionNotFoundError', () => {
const mockTransactionNotFoundError = new TransactionNotFoundError('Failed to get transaction with id txn, error Entry not found in index', 'txn1'); const mockTransactionNotFoundError = new TransactionNotFoundError(
'Failed to get transaction with id txn, error Entry not found in index',
'txn1'
);
expect(getRetryAction(mockTransactionNotFoundError)).toBe( expect(getRetryAction(mockTransactionNotFoundError)).toBe(
RetryAction.None RetryAction.None
@ -212,19 +215,21 @@ describe('Errors', () => {
}); });
it('returns RetryAction.None for an AssetExistsError', () => { it('returns RetryAction.None for an AssetExistsError', () => {
const mockAssetExistsError = new AssetExistsError('The asset MOCK_ASSET already exists', 'txn1'); const mockAssetExistsError = new AssetExistsError(
'The asset MOCK_ASSET already exists',
expect(getRetryAction(mockAssetExistsError)).toBe( 'txn1'
RetryAction.None
); );
expect(getRetryAction(mockAssetExistsError)).toBe(RetryAction.None);
}); });
it('returns RetryAction.None for an AssetNotFoundError', () => { it('returns RetryAction.None for an AssetNotFoundError', () => {
const mockAssetNotFoundError = new AssetNotFoundError('the asset MOCK_ASSET does not exist', 'txn1'); const mockAssetNotFoundError = new AssetNotFoundError(
'the asset MOCK_ASSET does not exist',
expect(getRetryAction(mockAssetNotFoundError)).toBe( 'txn1'
RetryAction.None
); );
expect(getRetryAction(mockAssetNotFoundError)).toBe(RetryAction.None);
}); });
it('returns RetryAction.WithExistingTransactionId for a TimeoutError', () => { it('returns RetryAction.WithExistingTransactionId for a TimeoutError', () => {
@ -247,17 +252,13 @@ describe('Errors', () => {
it('returns RetryAction.WithNewTransactionId for an Error', () => { it('returns RetryAction.WithNewTransactionId for an Error', () => {
const mockError = new Error('MOCK ERROR'); const mockError = new Error('MOCK ERROR');
expect(getRetryAction(mockError)).toBe( expect(getRetryAction(mockError)).toBe(RetryAction.WithNewTransactionId);
RetryAction.WithNewTransactionId
);
}); });
it('returns RetryAction.WithNewTransactionId for a string error', () => { it('returns RetryAction.WithNewTransactionId for a string error', () => {
const mockError = 'MOCK ERROR'; const mockError = 'MOCK ERROR';
expect(getRetryAction(mockError)).toBe( expect(getRetryAction(mockError)).toBe(RetryAction.WithNewTransactionId);
RetryAction.WithNewTransactionId
);
}); });
}); });

View file

@ -12,10 +12,10 @@
* Fabric transaction error handling and retry logic * Fabric transaction error handling and retry logic
* - fabric.ts * - fabric.ts
* all the sample code which interacts with the Fabric SDK * all the sample code which interacts with the Fabric SDK
* *
* The remaining files are related to the REST server aspects of the sample, * The remaining files are related to the REST server aspects of the sample,
* rather than Fabric itself: * rather than Fabric itself:
* *
* - *.router.ts * - *.router.ts
* details of the REST endpoints provided by the sample * details of the REST endpoints provided by the sample
* - auth.ts * - auth.ts

View file

@ -3,7 +3,12 @@
*/ */
import { Job, Queue } from 'bullmq'; import { Job, Queue } from 'bullmq';
import { getJobCounts, getJobSummary, processSubmitTransactionJob, JobNotFoundError } from './jobs'; import {
getJobCounts,
getJobSummary,
processSubmitTransactionJob,
JobNotFoundError,
} from './jobs';
import { Contract, Transaction } from 'fabric-network'; import { Contract, Transaction } from 'fabric-network';
import { mock, MockProxy } from 'jest-mock-extended'; import { mock, MockProxy } from 'jest-mock-extended';