-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide more detailed info when the email search fails due to a timeo…
…ut (#51) * print search criteria to log on timeout * provide more error details on search timeout Co-authored-by: ryanrosello-og <[email protected]>
- Loading branch information
1 parent
88dcdb1
commit e615a96
Showing
2 changed files
with
16 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,6 +202,21 @@ describe('emails', () => { | |
}); | ||
}); | ||
|
||
it('should throw a meaningful error if the timeout is reached', (done) => { | ||
const testFromEmail = '[email protected]'; | ||
client.messages | ||
.search(server, { | ||
sentFrom: testFromEmail | ||
}, { | ||
timeout: 1, | ||
}) | ||
.catch((err) => { | ||
assert.instanceOf(err, MailosaurError); | ||
assert.equal(err.message, `No matching messages found in time. By default, only messages received in the last hour are checked (use receivedAfter to override this). The search criteria used for this query was [{"sentFrom":"${testFromEmail}"}] which timed out after 1ms`); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should return empty array if errors suppressed', (done) => { | ||
client.messages.search(server, { | ||
sentTo: '[email protected]' | ||
|