@remit/backend 0.0.80 → 0.0.81

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/backend",
3
- "version": "0.0.80",
3
+ "version": "0.0.81",
4
4
  "description": "Remit Mail Inspector API backend",
5
5
  "license": "MIT",
6
6
  "author": "",
@@ -109,6 +109,15 @@ const createInMemoryOutboxRepository = (): IOutboxMessageRepository => {
109
109
  outboxMessageId: string,
110
110
  status: OutboxMessageItem["status"],
111
111
  ) => repository.update(accountConfigId, outboxMessageId, { status }),
112
+ updateIfStatus: async (
113
+ accountConfigId: string,
114
+ outboxMessageId: string,
115
+ expected: OutboxMessageItem["status"],
116
+ input: UpdateOutboxMessageInput,
117
+ ) => {
118
+ if (mustGet(outboxMessageId).status !== expected) return null;
119
+ return repository.update(accountConfigId, outboxMessageId, input);
120
+ },
112
121
  markSent: async (
113
122
  accountConfigId: string,
114
123
  outboxMessageId: string,
@@ -453,12 +462,17 @@ describe("a send whose enqueue fails (#845.8)", () => {
453
462
  assert.equal(response.statusCode, 500);
454
463
  });
455
464
 
456
- it("leaves the row a draft, not stranded at queued", async () => {
465
+ it("settles the row at failed, not stranded at queued and not back at draft", async () => {
457
466
  const { outboxMessageId } = await draftAgainstQueue(
458
467
  refusingSqsClient().client,
459
468
  );
460
469
 
461
- assert.equal(await statusOf(outboxMessageId), OutboxMessageStatus.draft);
470
+ // `queued` is the dead end this suite exists for. `draft` is the other
471
+ // wrong answer: it is inside the SMTP worker's send fence, and an error
472
+ // from SQS does not prove the event was refused — one that landed anyway
473
+ // would send a row the user can still send by hand. `failed` is outside
474
+ // the fence and, since #933, still editable and sendable.
475
+ assert.equal(await statusOf(outboxMessageId), OutboxMessageStatus.failed);
462
476
  });
463
477
 
464
478
  it("still lets the user discard what could not be queued", async () => {