Skip to content

Commit

Permalink
version 4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jasp402 committed Feb 2, 2024
1 parent 5f092f7 commit 0cc91fb
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 12 deletions.
15 changes: 3 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "easy-yopmail",
"version": "4.0.24",
"version": "4.1.0",
"description": "Easy-YOPmail (get mail address, inbox and read mail from YOPmail with nodeJS)",
"main": "dist/index.js",
"main": "scr/index.js",
"scripts": {
"build": "babel src --out-dir dist",
"release": "standard-version",
"test": "mocha src/test.spec.js --timeout 300000"
},
Expand Down Expand Up @@ -33,20 +32,12 @@
},
"homepage": "https://jasp402.gitbook.io/easy-yopmail/",
"devDependencies": {
"@babel/cli": "^7.21.5",
"@babel/core": "^7.21.8",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/preset-env": "^7.23.9",
"babel-preset-minify": "^0.5.2",
"babel-plugin-minify-mangle-names": "^0.5.1",
"mocha": "10.1.0",
"standard-version": "^9.5.0",
"terser": "^5.17.1"
},
"dependencies": {
"axios": "^1.6.7",
"cheerio": "^1.0.0-rc.10"
"cheerio": "^1.0.0-rc.12"
}
}
1 change: 1 addition & 0 deletions src/constants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions src/test.spec.js
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');
});
});
Loading

0 comments on commit 0cc91fb

Please sign in to comment.