chore: server code formatting

This commit is contained in:
Rafael Taranto 2025-05-12 15:35:00 +01:00
parent aedabcbdee
commit 68517170e2
234 changed files with 9824 additions and 6195 deletions

View file

@ -3,7 +3,7 @@ const utils = require('../utils')
const plugins = {
sendMessage: rec => {
return rec
}
},
}
const alertRec = {
@ -11,19 +11,19 @@ const alertRec = {
f02af604ca9010bd9ae04c427a24da90130da10d355f0a9b235886a89008fc05: {
balanceAlerts: [],
deviceAlerts: [
{ code: 'PING', age: 1605532263169, machineName: 'Abc123' }
]
}
{ code: 'PING', age: 1605532263169, machineName: 'Abc123' },
],
},
},
deviceNames: {
f02af604ca9010bd9ae04c427a24da90130da10d355f0a9b235886a89008fc05: 'Abc123'
f02af604ca9010bd9ae04c427a24da90130da10d355f0a9b235886a89008fc05: 'Abc123',
},
general: []
general: [],
}
const notifications = {
sms: { active: true, errors: true },
email: { active: false, errors: false }
email: { active: false, errors: false },
}
describe('buildAlertFingerprint', () => {
@ -33,37 +33,37 @@ describe('buildAlertFingerprint', () => {
{
devices: {},
deviceNames: {},
general: []
general: [],
},
notifications
)
notifications,
),
).toBe(null)
})
test('Build alert fingerprint returns null if sms and email are disabled', () => {
expect(
utils.buildAlertFingerprint(alertRec, {
sms: { active: false, errors: true },
email: { active: false, errors: false }
})
email: { active: false, errors: false },
}),
).toBe(null)
})
test('Build alert fingerprint returns hash if email or [sms] are enabled and there are alerts in alertrec', () => {
expect(
typeof utils.buildAlertFingerprint(alertRec, {
sms: { active: true, errors: true },
email: { active: false, errors: false }
})
email: { active: false, errors: false },
}),
).toBe('string')
})
test('Build alert fingerprint returns hash if [email] or sms are enabled and there are alerts in alertrec', () => {
expect(
typeof utils.buildAlertFingerprint(alertRec, {
sms: { active: false, errors: false },
email: { active: true, errors: true }
})
email: { active: true, errors: true },
}),
).toBe('string')
})
})
@ -76,8 +76,8 @@ describe('sendNoAlerts', () => {
test('Send no alerts returns object with sms prop with sms only enabled', () => {
expect(utils.sendNoAlerts(plugins, true, false)).toEqual({
sms: {
body: '[Lamassu] All clear'
}
body: '[Lamassu] All clear',
},
})
})
@ -85,11 +85,11 @@ describe('sendNoAlerts', () => {
expect(utils.sendNoAlerts(plugins, true, true)).toEqual({
email: {
body: 'No errors are reported for your machines.',
subject: '[Lamassu] All clear'
subject: '[Lamassu] All clear',
},
sms: {
body: '[Lamassu] All clear'
}
body: '[Lamassu] All clear',
},
})
})
@ -97,8 +97,8 @@ describe('sendNoAlerts', () => {
expect(utils.sendNoAlerts(plugins, false, true)).toEqual({
email: {
body: 'No errors are reported for your machines.',
subject: '[Lamassu] All clear'
}
subject: '[Lamassu] All clear',
},
})
})
})