Moved contact lib to adapters dir

This commit is contained in:
Chris Troutner
2021-07-07 17:08:30 -07:00
parent 36791231cc
commit c5e0a8a95b
4 changed files with 17 additions and 9 deletions
+4 -4
View File
@@ -30,10 +30,10 @@ class RateLimit {
set: () => {}
}
console.log(
`this.defaultOptions: ${JSON.stringify(this.defaultOptions, null, 2)}`
)
console.log(`options: ${JSON.stringify(options, null, 2)}`)
// console.log(
// `this.defaultOptions: ${JSON.stringify(this.defaultOptions, null, 2)}`
// )
// console.log(`options: ${JSON.stringify(options, null, 2)}`)
// Set rate limit settings. Default values are overwritten if user passes
// in an options object.
@@ -5,7 +5,7 @@
/* eslint-disable no-useless-escape */
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
const ContactLib = require('../../../lib/contact')
const ContactLib = require('../../../adapters/contact')
const contactLib = new ContactLib()
let _this
+12 -4
View File
@@ -1,7 +1,7 @@
const assert = require('chai').assert
const sinon = require('sinon')
const ContactLib = require('../../../src/lib/contact')
const ContactLib = require('../../../src/adapters/contact')
let uut
let sandbox
@@ -51,7 +51,10 @@ describe('Contact', () => {
await uut.sendEmail(data)
assert(false, 'Unexpected result')
} catch (err) {
assert.include(err.message, "Property 'emailList' must be a array of emails!")
assert.include(
err.message,
"Property 'emailList' must be a array of emails!"
)
}
})
@@ -67,7 +70,10 @@ describe('Contact', () => {
await uut.sendEmail(data)
assert(false, 'Unexpected result')
} catch (err) {
assert.include(err.message, "Property 'emailList' must be a array of emails!")
assert.include(
err.message,
"Property 'emailList' must be a array of emails!"
)
}
})
@@ -89,7 +95,9 @@ describe('Contact', () => {
it('should catch and throw nodemailer lib error', async () => {
try {
// Force an error with the database.
sandbox.stub(uut.nodemailer, 'sendEmail').throws(new Error('test error'))
sandbox
.stub(uut.nodemailer, 'sendEmail')
.throws(new Error('test error'))
const data = {
formMessage: 'test msg',