Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
added a small delay to getTokenFromMail test method to prevent issues
Browse files Browse the repository at this point in the history
  • Loading branch information
appinteractive committed Jun 29, 2018
1 parent 3b69b34 commit e132823
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/services/auth-management.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,19 @@ describe('\'authManagement\' service', () => {
});
});

const waitFor = (ms) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, ms);
});
};

const getTokenFromMail = async () => {
// Get token from tmp email file
const mailDir = path.join(__dirname, '../../tmp/emails');
// wait for the mail to be created first
await waitFor(50);
const fileName = await fs.readdirSync(mailDir)[0];
const mailFile = path.join(mailDir, fileName);
const mailContent = await fs.readFileSync(mailFile, 'utf8');
Expand Down

0 comments on commit e132823

Please sign in to comment.