Feat: enable notify operator for OFAC matches
Fix: fix lack of newline in some SVGs Chore: fix rebase issues
This commit is contained in:
parent
69d3e4cb9b
commit
05373e83db
6 changed files with 46 additions and 40 deletions
|
|
@ -2,8 +2,6 @@ const BigNumber = require('../../../lib/bn')
|
|||
|
||||
const notifier = require('..')
|
||||
const utils = require('../utils')
|
||||
const queries = require("../queries")
|
||||
const emailFuncs = require('../email')
|
||||
const smsFuncs = require('../sms')
|
||||
|
||||
afterEach(() => {
|
||||
|
|
@ -83,16 +81,16 @@ const notifSettings = {
|
|||
email_errors: false,
|
||||
sms_errors: true,
|
||||
sms_transactions: true,
|
||||
highValueTransaction: Infinity, //this will make highValueTx always false
|
||||
highValueTransaction: Infinity, // this will make highValueTx always false
|
||||
sms: {
|
||||
active: true,
|
||||
errors: true,
|
||||
transactions: false // force early return
|
||||
transactions: false // force early return
|
||||
},
|
||||
email: {
|
||||
active: false,
|
||||
errors: false,
|
||||
transactions: false // force early return
|
||||
transactions: false // force early return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +150,6 @@ test('Checkpings returns empty array as the value for the id prop, if the lastPi
|
|||
})
|
||||
})
|
||||
|
||||
|
||||
test('Check notification resolves to undefined if shouldNotAlert is called and is true', async () => {
|
||||
const mockShouldNotAlert = jest.spyOn(utils, 'shouldNotAlert')
|
||||
mockShouldNotAlert.mockReturnValue(true)
|
||||
|
|
@ -280,29 +277,23 @@ test('checkStuckScreen returns empty array if age < STALE_STATE', () => {
|
|||
expect(result2).toEqual([])
|
||||
})
|
||||
|
||||
test("calls sendRedemptionMessage if !zeroConf and rec.isRedemption", async () => {
|
||||
test('calls sendRedemptionMessage if !zeroConf and rec.isRedemption', async () => {
|
||||
const configManager = require('../../new-config-manager')
|
||||
const settingsLoader = require('../../new-settings-loader')
|
||||
|
||||
const loadLatest = jest.spyOn(settingsLoader, 'loadLatest')
|
||||
const loadLatest = jest.spyOn(settingsLoader, 'loadLatest')
|
||||
const getGlobalNotifications = jest.spyOn(configManager, 'getGlobalNotifications')
|
||||
const getCashOut = jest.spyOn(configManager, 'getCashOut')
|
||||
|
||||
// sendRedemptionMessage will cause this func to be called
|
||||
jest.spyOn(smsFuncs, 'sendMessage').mockImplementation((_, rec) => rec)
|
||||
|
||||
<<<<<<< HEAD
|
||||
getCashOut.mockReturnValue({zeroConfLimit: -Infinity})
|
||||
loadLatest.mockReturnValue({})
|
||||
getGlobalNotifications.mockReturnValue({... notifSettings, sms: { active: true, errors: true, transactions: true }})
|
||||
=======
|
||||
getCashOut.mockReturnValue({ zeroConfLimit: -Infinity })
|
||||
loadLatest.mockReturnValue(Promise.resolve({}))
|
||||
getGlobalNotifications.mockReturnValue({ ...notifSettings, sms: { active: true, errors: true, transactions: true }, notificationCenter: { active: true } })
|
||||
>>>>>>> a7a9fd3... Feat: move notif center fns to own file on the notifier module
|
||||
getGlobalNotifications.mockReturnValue({ ...notifSettings, sms: { active: true, errors: true, transactions: true }, notificationCenter: { active: true } })
|
||||
|
||||
const response = await notifier.transactionNotify(tx, { isRedemption: true })
|
||||
|
||||
const response = await notifier.transactionNotify(tx, {isRedemption: true})
|
||||
|
||||
// this type of response implies sendRedemptionMessage was called
|
||||
expect(response[0]).toMatchObject({
|
||||
sms: {
|
||||
|
|
@ -315,29 +306,29 @@ test("calls sendRedemptionMessage if !zeroConf and rec.isRedemption", async () =
|
|||
})
|
||||
})
|
||||
|
||||
test("calls sendTransactionMessage if !zeroConf and !rec.isRedemption", async () => {
|
||||
test('calls sendTransactionMessage if !zeroConf and !rec.isRedemption', async () => {
|
||||
const configManager = require('../../new-config-manager')
|
||||
const settingsLoader = require('../../new-settings-loader')
|
||||
const machineLoader = require('../../machine-loader')
|
||||
|
||||
const loadLatest = jest.spyOn(settingsLoader, 'loadLatest')
|
||||
const loadLatest = jest.spyOn(settingsLoader, 'loadLatest')
|
||||
const getGlobalNotifications = jest.spyOn(configManager, 'getGlobalNotifications')
|
||||
const getCashOut = jest.spyOn(configManager, 'getCashOut')
|
||||
const getMachineName = jest.spyOn(machineLoader, 'getMachineName')
|
||||
const buildTransactionMessage = jest.spyOn(utils, 'buildTransactionMessage')
|
||||
|
||||
// sendMessage on emailFuncs isn't called because it is disabled in getGlobalNotifications.mockReturnValue
|
||||
jest.spyOn(smsFuncs, 'sendMessage').mockImplementation((_, rec) => ({prop: rec}))
|
||||
buildTransactionMessage.mockImplementation(() => ["mock message", false])
|
||||
jest.spyOn(smsFuncs, 'sendMessage').mockImplementation((_, rec) => ({ prop: rec }))
|
||||
buildTransactionMessage.mockImplementation(() => ['mock message', false])
|
||||
|
||||
getMachineName.mockReturnValue('mockMachineName')
|
||||
getCashOut.mockReturnValue({ zeroConfLimit: -Infinity })
|
||||
loadLatest.mockReturnValue(Promise.resolve({}))
|
||||
getGlobalNotifications.mockReturnValue({ ...notifSettings, sms: { active: true, errors: true, transactions: true }, notificationCenter: { active: true } })
|
||||
|
||||
const response = await notifier.transactionNotify(tx, {isRedemption: false})
|
||||
const response = await notifier.transactionNotify(tx, { isRedemption: false })
|
||||
|
||||
// If the return object is this, it means the code went through all the functions expected to go through if
|
||||
// If the return object is this, it means the code went through all the functions expected to go through if
|
||||
// getMachineName, buildTransactionMessage and sendTransactionMessage were called, in this order
|
||||
expect(response).toEqual([{prop: 'mock message'}])
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue