@tryghost/email-mock-receiver 2.0.2 → 2.1.0

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.
package/README.md CHANGED
@@ -8,7 +8,7 @@ Mocks email sending method and manages snapshots for outgoing email information
8
8
 
9
9
  or
10
10
 
11
- `yarn add @tryghost/email-mock-receiver`
11
+ `pnpm add @tryghost/email-mock-receiver`
12
12
 
13
13
  ## Purpose
14
14
 
@@ -16,19 +16,16 @@ Test helper that captures outbound email payloads for assertions in automated te
16
16
 
17
17
  ## Usage
18
18
 
19
-
20
19
  ## Develop
21
20
 
22
21
  This is a monorepo package.
23
22
 
24
23
  Follow the instructions for the top-level repo.
25
- 1. `git clone` this repo & `cd` into it as usual
26
- 2. Run `yarn` to install top-level dependencies.
27
-
28
24
 
25
+ 1. `git clone` this repo & `cd` into it as usual
26
+ 2. Run `pnpm install` to install top-level dependencies.
29
27
 
30
28
  ## Test
31
29
 
32
- - `yarn lint` run just eslint
33
- - `yarn test` run lint and tests
34
-
30
+ - `pnpm lint` runs oxlint
31
+ - `pnpm test` runs lint and tests
@@ -1,12 +1,12 @@
1
1
  const assert = require('assert');
2
- const {AssertionError} = require('assert');
2
+ const { AssertionError } = require('assert');
3
3
 
4
4
  class EmailMockReceiver {
5
5
  #sendResponse;
6
6
  #snapshotManager;
7
7
  #snapshots = [];
8
8
 
9
- constructor({snapshotManager, sendResponse = 'Mail is disabled'}) {
9
+ constructor({ snapshotManager, sendResponse = 'Mail is disabled' }) {
10
10
  this.#snapshotManager = snapshotManager;
11
11
  this.#sendResponse = sendResponse;
12
12
  }
@@ -56,12 +56,12 @@ class EmailMockReceiver {
56
56
  properties: null,
57
57
  field: field,
58
58
  hint: `[${field} ${snapshotIndex + 1}]`,
59
- error
59
+ error,
60
60
  };
61
61
 
62
62
  let text = this.#snapshots[snapshotIndex][field];
63
63
  if (replacements.length) {
64
- for (const [, {pattern, replacement}] of Object.entries(replacements)) {
64
+ for (const [, { pattern, replacement }] of Object.entries(replacements)) {
65
65
  text = text.replace(pattern, replacement);
66
66
  }
67
67
  }
@@ -105,16 +105,19 @@ class EmailMockReceiver {
105
105
  properties: properties,
106
106
  field: 'metadata',
107
107
  hint: `[metadata ${snapshotIndex + 1}]`,
108
- error
108
+ error,
109
109
  };
110
110
 
111
111
  const metadata = Object.assign({}, this.#snapshots[snapshotIndex]);
112
112
  delete metadata.html;
113
113
  delete metadata.text;
114
114
 
115
- this.#snapshotManager.assertSnapshot({
116
- metadata
117
- }, assertion);
115
+ this.#snapshotManager.assertSnapshot(
116
+ {
117
+ metadata,
118
+ },
119
+ assertion,
120
+ );
118
121
 
119
122
  return this;
120
123
  }
package/package.json CHANGED
@@ -1,30 +1,28 @@
1
1
  {
2
2
  "name": "@tryghost/email-mock-receiver",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
+ "license": "MIT",
5
+ "author": "Ghost Foundation",
4
6
  "repository": {
5
7
  "type": "git",
6
8
  "url": "git+https://github.com/TryGhost/framework.git",
7
9
  "directory": "packages/email-mock-receiver"
8
10
  },
9
- "author": "Ghost Foundation",
10
- "license": "MIT",
11
- "main": "index.js",
12
- "scripts": {
13
- "dev": "echo \"Implement me!\"",
14
- "test:unit": "NODE_ENV=testing vitest run --coverage --config ../../vitest.config.ts",
15
- "test": "yarn test:unit",
16
- "lint:code": "eslint *.js lib/ --ext .js --cache",
17
- "lint": "yarn lint:code && yarn lint:test",
18
- "lint:test": "eslint -c test/.eslintrc.js test/ --ext .js --cache"
19
- },
20
11
  "files": [
21
12
  "index.js",
22
13
  "lib"
23
14
  ],
15
+ "main": "index.js",
24
16
  "publishConfig": {
25
17
  "access": "public"
26
18
  },
27
19
  "devDependencies": {
28
- "sinon": "21.0.2"
20
+ "sinon": "21.1.2"
21
+ },
22
+ "scripts": {
23
+ "dev": "echo \"Implement me!\"",
24
+ "test:unit": "NODE_ENV=testing vitest run --coverage --config ../../vitest.config.ts",
25
+ "test": "pnpm run test:unit",
26
+ "lint": "oxlint -c ../../.oxlintrc.json ."
29
27
  }
30
- }
28
+ }