-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added multiple tradingview indicators (#539)
- Loading branch information
1 parent
0c04b66
commit 7988078
Showing
88 changed files
with
9,134 additions
and
7,058 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
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 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 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 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 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 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 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 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,86 @@ | ||
/* eslint-disable max-classes-per-file */ | ||
/* eslint-disable global-require */ | ||
const { logger } = require('../../helpers'); | ||
|
||
describe('tradingView', () => { | ||
let mockLoggerInfo; | ||
|
||
let mockGetGlobalConfiguration; | ||
let mockGetTradingView; | ||
|
||
let mockErrorHandlerWrapper; | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks().resetModules(); | ||
|
||
mockLoggerInfo = jest.fn(); | ||
|
||
logger.info = mockLoggerInfo; | ||
jest.mock('../../helpers', () => ({ | ||
logger: { | ||
info: mockLoggerInfo, | ||
error: jest.fn(), | ||
warn: jest.fn(), | ||
debug: jest.fn(), | ||
child: jest.fn() | ||
} | ||
})); | ||
|
||
mockErrorHandlerWrapper = jest | ||
.fn() | ||
.mockImplementation((_logger, _job, callback) => | ||
Promise.resolve(callback()) | ||
); | ||
|
||
jest.mock('../../error-handler', () => ({ | ||
errorHandlerWrapper: mockErrorHandlerWrapper | ||
})); | ||
}); | ||
|
||
const mockSteps = () => { | ||
mockGetGlobalConfiguration = jest | ||
.fn() | ||
.mockImplementation((_logger, rawData) => ({ | ||
...rawData, | ||
...{ | ||
globalConfiguration: { | ||
global: 'configuration data' | ||
} | ||
} | ||
})); | ||
|
||
mockGetTradingView = jest.fn().mockImplementation((_logger, rawData) => ({ | ||
...rawData, | ||
...{ | ||
tradingView: { tradingview: 'data' } | ||
} | ||
})); | ||
|
||
jest.mock('../trailingTradeIndicator/steps', () => ({ | ||
getGlobalConfiguration: mockGetGlobalConfiguration, | ||
getTradingView: mockGetTradingView | ||
})); | ||
}; | ||
|
||
describe('without any error', () => { | ||
beforeEach(async () => { | ||
mockSteps(); | ||
|
||
const { execute: tradingViewExecute } = require('../tradingView'); | ||
|
||
await tradingViewExecute(logger); | ||
}); | ||
|
||
it('returns expected result', () => { | ||
expect(mockLoggerInfo).toHaveBeenCalledWith( | ||
{ | ||
data: { | ||
globalConfiguration: { global: 'configuration data' }, | ||
tradingView: { tradingview: 'data' } | ||
} | ||
}, | ||
'TradingView: Finish process...' | ||
); | ||
}); | ||
}); | ||
}); |
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 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
Oops, something went wrong.