-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
88 additions
and
12 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,82 @@ | ||
const constants = require('./constants.js'); | ||
const easyYopmail = {getInbox, getMailDetail, deleteMail, deleteInbox} = require('./index.js'); | ||
const assert = require('assert'); | ||
|
||
let mails = []; | ||
let inbox = undefined; | ||
let mailDetail = undefined; | ||
let firstMail = undefined; | ||
let secondMail = undefined; | ||
|
||
describe('🧪 TESTING GENERATE E-MAILS', () => { | ||
it('should, generate email dynamically', async () => { | ||
mails.push(await easyYopmail.getMail()); | ||
console.log(mails[0]); | ||
assert.match(mails[0], /yopmail/g); | ||
assert.ok(mails[0]); | ||
}); | ||
it('should, generate new email and be differents', async () => { | ||
mails.push(await easyYopmail.getMail()); | ||
console.log(mails[1]); | ||
assert.match(mails[1], /yopmail/g); | ||
assert.notStrictEqual(mails[0], mails[1]); | ||
}); | ||
it('should, generate new email and be diferent to before', async () => { | ||
mails.push(await easyYopmail.getMail()); | ||
console.log(mails[2]); | ||
assert.match(mails[2], /yopmail/g); | ||
assert.notStrictEqual(mails[1], mails[2]); | ||
}); | ||
}); | ||
|
||
describe('🧪 TESTING INBOX', () => { | ||
|
||
before(async () => { | ||
inbox = await easyYopmail.getInbox(constants.TEST_MAIL); | ||
}); | ||
|
||
it('should, inbox has properties', () => { | ||
console.log(inbox); | ||
assert.ok(inbox.hasOwnProperty('settings')); | ||
assert.ok(inbox.hasOwnProperty('search')); | ||
assert.ok(inbox.hasOwnProperty('totalInbox')); | ||
assert.ok(inbox.hasOwnProperty('totalPages')); | ||
assert.ok(inbox.hasOwnProperty('mailFromPage')); | ||
assert.ok(inbox.hasOwnProperty('totalGetMails')); | ||
assert.ok(inbox.hasOwnProperty('inbox')); | ||
}); | ||
|
||
// it('should, inbox has property maxPage', () => { | ||
// | ||
// }); | ||
// | ||
// it('should, default number page getting is 1', () => { | ||
// assert.strictEqual(inbox.maxPage, 1); | ||
// }); | ||
// | ||
// it('should, inbox has property pages ', () => { | ||
// assert.ok(inbox.hasOwnProperty('pages')); | ||
// }); | ||
// | ||
// it('should, property page is array', () => { | ||
// assert.ok(Array.isArray(inbox.pages)); | ||
// }); | ||
// | ||
// it('should, pages to equal 1', () => { | ||
// assert.strictEqual(inbox.pages.length, 1); | ||
// }); | ||
|
||
}); | ||
|
||
describe('🧪 TESTING WRITE EMAIL', () => { | ||
it('should, Send email', async () => { | ||
let time = new Date().getTime(); | ||
let mail = 'sender01'; | ||
let to = 'receiver01'; | ||
let subject = 'testing_'+time; | ||
let body = 'This a test that function writeMessage works! DEMO N°: '+time; | ||
let email = await easyYopmail.writeMessage(mail, to, subject, body); | ||
console.log(email); | ||
assert.strictEqual(email, 'OK|mobback|Your message has been sent'); | ||
}); | ||
}); |
Oops, something went wrong.