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

View file

@ -0,0 +1,22 @@
const sms = require('../sms')
const alertRec = {
devices: {
f02af604ca9010bd9ae04c427a24da90130da10d355f0a9b235886a89008fc05: {
balanceAlerts: [],
deviceAlerts: [
{ code: 'PING', age: 602784301.446, machineName: 'Abc123' }
]
}
},
deviceNames: {
f02af604ca9010bd9ae04c427a24da90130da10d355f0a9b235886a89008fc05: 'Abc123'
},
general: []
}
test('Print SMS alerts', () => {
expect(sms.printSmsAlerts(alertRec, { active: true, errors: true })).toBe(
'[Lamassu] Errors reported: Machine Down (Abc123)'
)
})