Feat: code refactoring and jest tests

chore: More refactoring

chore: More tests and refactors

fix: Fixed age not getting calculated properly

chore: Implemented mocking in jest

chore: More mock tests

chore: checkStuckScreen tests
This commit is contained in:
Cesar 2020-11-23 16:08:12 +00:00 committed by Josh Harvey
parent 65165b943b
commit 04fd82454d
12 changed files with 1047 additions and 66 deletions

34
lib/notifier/codes.js Normal file
View file

@ -0,0 +1,34 @@
const T = require('../time')
const PING = 'PING'
const STALE = 'STALE'
const LOW_CRYPTO_BALANCE = 'LOW_CRYPTO_BALANCE'
const HIGH_CRYPTO_BALANCE = 'HIGH_CRYPTO_BALANCE'
const CASH_BOX_FULL = 'CASH_BOX_FULL'
const LOW_CASH_OUT = 'LOW_CASH_OUT'
const CODES_DISPLAY = {
PING: 'Machine Down',
STALE: 'Machine Stuck',
LOW_CRYPTO_BALANCE: 'Low Crypto Balance',
HIGH_CRYPTO_BALANCE: 'High Crypto Balance',
CASH_BOX_FULL: 'Cash box full',
LOW_CASH_OUT: 'Low Cash-out'
}
const NETWORK_DOWN_TIME = 1 * T.minute
const STALE_STATE = 7 * T.minute
const ALERT_SEND_INTERVAL = T.hour
module.exports = {
PING,
STALE,
LOW_CRYPTO_BALANCE,
HIGH_CRYPTO_BALANCE,
CASH_BOX_FULL,
LOW_CASH_OUT,
CODES_DISPLAY,
NETWORK_DOWN_TIME,
STALE_STATE,
ALERT_SEND_INTERVAL
}