@tryghost/email-mock-receiver 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,13 +14,7 @@ class EmailMockReceiver {
14
14
  /**
15
15
  * Method mocking email sending logic
16
16
  *
17
- * @param {Object} message
18
- * @param {string} message.subject - email subject
19
- * @param {string} message.html - email content
20
- * @param {string} message.to - email recipient address
21
- * @param {string} [message.replyTo]
22
- * @param {string} [message.from] - sender email address
23
- * @param {string} [message.text] - text version of this message
17
+ * @param {EmailMessage} message - email message
24
18
  */
25
19
  async send(message) {
26
20
  // store snapshot
@@ -29,6 +23,15 @@ class EmailMockReceiver {
29
23
  return this.#sendResponse;
30
24
  }
31
25
 
26
+ /**
27
+ *
28
+ * @param {Number} [index] zero-based index of the sent email
29
+ * @returns {EmailMessage}
30
+ */
31
+ getSentEmail(index = 0) {
32
+ return this.#snapshots[index];
33
+ }
34
+
32
35
  /**
33
36
  *
34
37
  * @param {Number} count number of sent emails to expect
@@ -128,3 +131,13 @@ module.exports = EmailMockReceiver;
128
131
  * @prop {String|RegExp} [pattern] - pattern to match the dynamic content
129
132
  * @prop {String} [replacement] - replacement for the matched pattern
130
133
  */
134
+
135
+ /**
136
+ * @typedef {Object} EmailMessage
137
+ * @prop {String} subject - email subject
138
+ * @prop {String} html - email HTML content
139
+ * @prop {String} to - email recipient address
140
+ * @prop {String} [replyTo] - email reply-to address
141
+ * @prop {String} [from] - sender email address
142
+ * @prop {String} [text] - text version of email message
143
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/email-mock-receiver",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "repository": "https://github.com/TryGhost/framework/tree/main/packages/email-mock-receiver",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  "devDependencies": {
24
24
  "c8": "7.13.0",
25
25
  "mocha": "10.2.0",
26
- "sinon": "15.0.3"
26
+ "sinon": "15.0.4"
27
27
  },
28
- "gitHead": "8ad6d578e538e8de4a9edbef397febfaf8ae2d92"
28
+ "gitHead": "4bf425a83dabe8e70ee28dffa37cf678b640068e"
29
29
  }