-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ft 164489793 writing test for the user notification
- Loading branch information
Frank Harerimana
authored and
Frank Harerimana
committed
Apr 26, 2019
1 parent
19a0760
commit 02bce11
Showing
5 changed files
with
46 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import chai from 'chai'; | ||
import debug from 'debug'; | ||
import dotenv from 'dotenv'; | ||
import faker from 'faker'; | ||
import Mailer from '../helpers/mailer'; | ||
import userEvents from '../helpers/userEvents'; | ||
|
||
dotenv.config(); | ||
process.env.NODE_ENV = 'test'; | ||
chai.should(); | ||
|
||
const logError = debug('app:*'); | ||
|
||
const data = { | ||
email: faker.internet.email(), | ||
subject: faker.random.words(), | ||
message: faker.lorem.paragraphs(), | ||
footer: faker.lorem.sentences() | ||
}; | ||
describe('mailer class', () => { | ||
it('should be able to send email', async () => { | ||
try { | ||
const res = await Mailer.messageMaker(data.email, data.subject, data.message, data.footer); | ||
res.should.be.a('boolean'); | ||
} catch (error) { | ||
logError(error); | ||
} | ||
}); | ||
}); | ||
|
||
describe('user event handler', () => { | ||
it('should pass data to the controller and return sucess', async () => { | ||
try { | ||
const event = new userEvents(); | ||
const res = event.verifyingAccount(faker.random.number()); | ||
res.should.be.a('string'); | ||
} catch (error) { | ||
logError(error); | ||
} | ||
}); | ||
}); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters