yopmail-helper
Version:
yopmail helper. It will help you receive the mail content.
25 lines (21 loc) • 793 B
JavaScript
const { getLatestMailByEmailAddress } = require('../index');
const { delay } = require('../utils/delay/delays');
describe('getLatestMailByEmailAddress', () => {
beforeEach(async () => {
await delay(5000);
});
it('Should fetch the latest mail if it exists', async () => {
const latestMail = await getLatestMailByEmailAddress('admin01');
if (latestMail) {
expect(latestMail).toHaveProperty('id');
expect(latestMail).toHaveProperty('title');
expect(latestMail).toHaveProperty('body');
} else {
expect(latestMail).toBeNull();
}
});
it('Should return null for an empty inbox', async () => {
const latestMail = await getLatestMailByEmailAddress('this-is-a-very-unique-and-empty-inbox-12345');
expect(latestMail).toBeNull();
});
});