@remit/imap-worker 0.0.70 → 0.0.72
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 +1 -2
- package/src/handlers/append-sent-message.test.ts +20 -30
- package/src/handlers/delete-account-objects.test.ts +6 -16
- package/src/handlers/empty-trash.test.ts +26 -33
- package/src/handlers/mailbox-management.test.ts +25 -35
- package/src/handlers/message-copy.test.ts +25 -35
- package/src/handlers/message-delete.test.ts +40 -49
- package/src/handlers/sync-message-body.ts +1 -1
- package/src/filter-config.test.ts +0 -171
- package/src/filter-config.ts +0 -63
- package/src/message-embedder.test.ts +0 -39
- package/src/message-embedder.ts +0 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remit/imap-worker",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.72",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"@remit/logger-lambda": "*",
|
|
40
40
|
"@remit/mailbox-service": "*",
|
|
41
41
|
"@remit/search-index-worker": "*",
|
|
42
|
-
"@remit/search-service": "*",
|
|
43
42
|
"@remit/sqs-client": "*",
|
|
44
43
|
"@remit/backend": "*",
|
|
45
44
|
"@remit/domain-enums": "*",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { beforeEach, describe, it } from "node:test";
|
|
3
|
-
import
|
|
3
|
+
import { noopLogger } from "@remit/logger-lambda/noop-logger";
|
|
4
4
|
import type { AppendSentMessageEvent } from "../events.js";
|
|
5
5
|
import {
|
|
6
6
|
APPEND_SENT_MAX_ATTEMPTS,
|
|
@@ -8,16 +8,6 @@ import {
|
|
|
8
8
|
handleAppendSentMessage,
|
|
9
9
|
} from "./append-sent-message.js";
|
|
10
10
|
|
|
11
|
-
const noopLog = {
|
|
12
|
-
info: () => {},
|
|
13
|
-
warn: () => {},
|
|
14
|
-
error: () => {},
|
|
15
|
-
debug: () => {},
|
|
16
|
-
fatal: () => {},
|
|
17
|
-
trace: () => {},
|
|
18
|
-
child: () => noopLog,
|
|
19
|
-
} as unknown as Logger;
|
|
20
|
-
|
|
21
11
|
interface Call {
|
|
22
12
|
method: string;
|
|
23
13
|
args: unknown[];
|
|
@@ -175,7 +165,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
175
165
|
});
|
|
176
166
|
|
|
177
167
|
it("appends a seen RFC822 copy to the Sent folder and drops the outbox row", async () => {
|
|
178
|
-
await handleAppendSentMessage(event,
|
|
168
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
179
169
|
|
|
180
170
|
const append = called("connection.append")[0];
|
|
181
171
|
assert.equal(append?.args[0], "INBOX/Sent");
|
|
@@ -188,7 +178,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
188
178
|
});
|
|
189
179
|
|
|
190
180
|
it("takes the draft's stored attachments with the row (#679)", async () => {
|
|
191
|
-
await handleAppendSentMessage(event,
|
|
181
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
192
182
|
|
|
193
183
|
// The row is the only reference to those objects. Sweeping has to happen
|
|
194
184
|
// here too, not only on a discard, or a sent message leaves its files
|
|
@@ -201,7 +191,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
201
191
|
});
|
|
202
192
|
|
|
203
193
|
it("builds the message from the outbox row's own headers", async () => {
|
|
204
|
-
await handleAppendSentMessage(event,
|
|
194
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
205
195
|
|
|
206
196
|
const raw = String(called("connection.append")[0]?.args[1] as Buffer);
|
|
207
197
|
assert.match(raw, /^From: Alice <alice@example\.com>$/m);
|
|
@@ -216,7 +206,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
216
206
|
it("uses a bare address when the outbox row carries no display name", async () => {
|
|
217
207
|
h.outbox = { ...h.outbox, fromName: undefined };
|
|
218
208
|
|
|
219
|
-
await handleAppendSentMessage(event,
|
|
209
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
220
210
|
|
|
221
211
|
const raw = String(called("connection.append")[0]?.args[1] as Buffer);
|
|
222
212
|
assert.match(raw, /^From: alice@example\.com$/m);
|
|
@@ -225,7 +215,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
225
215
|
it("settles the row as unfiled when the account has no Sent folder at all", async () => {
|
|
226
216
|
h.sentMailbox = null;
|
|
227
217
|
|
|
228
|
-
await handleAppendSentMessage(event,
|
|
218
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
229
219
|
|
|
230
220
|
assert.equal(called("connection.append").length, 0);
|
|
231
221
|
assert.equal(called("outboxMessage.delete").length, 0);
|
|
@@ -243,7 +233,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
243
233
|
it("skips the append while the outbox row is not yet sent", async () => {
|
|
244
234
|
h.outbox = { ...h.outbox, status: "pending" };
|
|
245
235
|
|
|
246
|
-
await handleAppendSentMessage(event,
|
|
236
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
247
237
|
|
|
248
238
|
assert.equal(called("connection.append").length, 0);
|
|
249
239
|
assert.equal(called("outboxMessage.delete").length, 0);
|
|
@@ -252,7 +242,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
252
242
|
it("returns early without touching the outbox when the account is soft-deleted", async () => {
|
|
253
243
|
h.account = { ...h.account, deletedAt: Date.now() };
|
|
254
244
|
|
|
255
|
-
await handleAppendSentMessage(event,
|
|
245
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
256
246
|
|
|
257
247
|
assert.equal(called("connection.append").length, 0);
|
|
258
248
|
assert.equal(called("outboxMessage.delete").length, 0);
|
|
@@ -264,7 +254,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
264
254
|
};
|
|
265
255
|
|
|
266
256
|
await assert.rejects(
|
|
267
|
-
handleAppendSentMessage(event,
|
|
257
|
+
handleAppendSentMessage(event, noopLogger, 1, deps()),
|
|
268
258
|
/server exploded/,
|
|
269
259
|
);
|
|
270
260
|
|
|
@@ -282,7 +272,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
282
272
|
|
|
283
273
|
await handleAppendSentMessage(
|
|
284
274
|
event,
|
|
285
|
-
|
|
275
|
+
noopLogger,
|
|
286
276
|
APPEND_SENT_MAX_ATTEMPTS,
|
|
287
277
|
deps(),
|
|
288
278
|
);
|
|
@@ -301,7 +291,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
301
291
|
it("settles the row as unfiled when a terminal auth failure acks the record", async () => {
|
|
302
292
|
h.ackWithoutWork = true;
|
|
303
293
|
|
|
304
|
-
await handleAppendSentMessage(event,
|
|
294
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
305
295
|
|
|
306
296
|
const patch = called("outboxMessage.update")[0]?.args[2] as {
|
|
307
297
|
status: string;
|
|
@@ -313,7 +303,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
313
303
|
|
|
314
304
|
it("leaves the row alone when the APPEND landed but the delete did not", async () => {
|
|
315
305
|
await assert.rejects(
|
|
316
|
-
handleAppendSentMessage(event,
|
|
306
|
+
handleAppendSentMessage(event, noopLogger, 1, depsWithFailingDelete()),
|
|
317
307
|
/storage down/,
|
|
318
308
|
);
|
|
319
309
|
|
|
@@ -325,7 +315,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
325
315
|
it("stops redelivering a landed APPEND at the budget instead of filing another copy", async () => {
|
|
326
316
|
await handleAppendSentMessage(
|
|
327
317
|
event,
|
|
328
|
-
|
|
318
|
+
noopLogger,
|
|
329
319
|
APPEND_SENT_MAX_ATTEMPTS,
|
|
330
320
|
depsWithFailingDelete(),
|
|
331
321
|
);
|
|
@@ -335,7 +325,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
335
325
|
});
|
|
336
326
|
|
|
337
327
|
it("records the uid the APPEND produced before it deletes the row", async () => {
|
|
338
|
-
await handleAppendSentMessage(event,
|
|
328
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
339
329
|
|
|
340
330
|
// Order is the whole of it: a uid written after the delete is a uid a
|
|
341
331
|
// redelivery never sees, and the redelivery is what files the second copy.
|
|
@@ -352,7 +342,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
352
342
|
// nothing, and "filed" still has to be told apart from "not filed".
|
|
353
343
|
h.append = async () => ({ uid: 0, uidValidity: 0 });
|
|
354
344
|
|
|
355
|
-
await handleAppendSentMessage(event,
|
|
345
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
356
346
|
|
|
357
347
|
assert.deepEqual(patches(), [{ appendedUid: -1 }]);
|
|
358
348
|
assert.equal(called("outboxMessage.delete").length, 1);
|
|
@@ -361,7 +351,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
361
351
|
it("files nothing a second time when a redelivery finds a recorded uid (#858)", async () => {
|
|
362
352
|
h.outbox = { ...h.outbox, appendedUid: 55 };
|
|
363
353
|
|
|
364
|
-
await handleAppendSentMessage(event,
|
|
354
|
+
await handleAppendSentMessage(event, noopLogger, 1, deps());
|
|
365
355
|
|
|
366
356
|
// The copy is already in the user's Sent folder. All this redelivery owes
|
|
367
357
|
// is the delete the last attempt could not make.
|
|
@@ -382,7 +372,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
382
372
|
h.outbox = { ...h.outbox, appendedUid: 55 };
|
|
383
373
|
|
|
384
374
|
await assert.rejects(
|
|
385
|
-
handleAppendSentMessage(event,
|
|
375
|
+
handleAppendSentMessage(event, noopLogger, 1, depsWithFailingDelete()),
|
|
386
376
|
/storage down/,
|
|
387
377
|
);
|
|
388
378
|
|
|
@@ -392,7 +382,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
392
382
|
|
|
393
383
|
it("keeps the row when the uid cannot be recorded", async () => {
|
|
394
384
|
await assert.rejects(
|
|
395
|
-
handleAppendSentMessage(event,
|
|
385
|
+
handleAppendSentMessage(event, noopLogger, 1, depsWithFailingUpdate()),
|
|
396
386
|
/storage down/,
|
|
397
387
|
);
|
|
398
388
|
|
|
@@ -425,7 +415,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
425
415
|
},
|
|
426
416
|
};
|
|
427
417
|
|
|
428
|
-
await handleAppendSentMessage(event,
|
|
418
|
+
await handleAppendSentMessage(event, noopLogger, 1, failing);
|
|
429
419
|
|
|
430
420
|
assert.equal(called("connection.append").length, 0);
|
|
431
421
|
assert.deepEqual(patches(), []);
|
|
@@ -436,7 +426,7 @@ describe("handleAppendSentMessage", () => {
|
|
|
436
426
|
|
|
437
427
|
await handleAppendSentMessage(
|
|
438
428
|
event,
|
|
439
|
-
|
|
429
|
+
noopLogger,
|
|
440
430
|
APPEND_SENT_MAX_ATTEMPTS,
|
|
441
431
|
depsWithFailingDelete(),
|
|
442
432
|
);
|
|
@@ -6,21 +6,11 @@ import {
|
|
|
6
6
|
S3Client,
|
|
7
7
|
} from "@aws-sdk/client-s3";
|
|
8
8
|
import { SendMessageCommand, SQSClient } from "@aws-sdk/client-sqs";
|
|
9
|
-
import
|
|
9
|
+
import { noopLogger } from "@remit/logger-lambda/noop-logger";
|
|
10
10
|
import { mockClient } from "aws-sdk-client-mock";
|
|
11
11
|
import type { DeleteAccountObjectsEvent } from "../events.js";
|
|
12
12
|
import { handleDeleteAccountObjects } from "./delete-account-objects.js";
|
|
13
13
|
|
|
14
|
-
const noopLog = {
|
|
15
|
-
info: () => {},
|
|
16
|
-
warn: () => {},
|
|
17
|
-
error: () => {},
|
|
18
|
-
debug: () => {},
|
|
19
|
-
fatal: () => {},
|
|
20
|
-
trace: () => {},
|
|
21
|
-
child: () => noopLog,
|
|
22
|
-
} as unknown as Logger;
|
|
23
|
-
|
|
24
14
|
const s3Mock = mockClient(S3Client);
|
|
25
15
|
const sqsMock = mockClient(SQSClient);
|
|
26
16
|
|
|
@@ -45,7 +35,7 @@ describe("handleDeleteAccountObjects", () => {
|
|
|
45
35
|
});
|
|
46
36
|
s3Mock.on(DeleteObjectsCommand).resolves({});
|
|
47
37
|
|
|
48
|
-
await handleDeleteAccountObjects(event,
|
|
38
|
+
await handleDeleteAccountObjects(event, noopLogger);
|
|
49
39
|
|
|
50
40
|
const listCall = s3Mock.commandCalls(ListObjectsV2Command)[0];
|
|
51
41
|
assert.equal(listCall.args[0].input.Prefix, "accounts/cfg-1/");
|
|
@@ -72,7 +62,7 @@ describe("handleDeleteAccountObjects", () => {
|
|
|
72
62
|
});
|
|
73
63
|
s3Mock.on(DeleteObjectsCommand).resolves({});
|
|
74
64
|
|
|
75
|
-
await handleDeleteAccountObjects(event,
|
|
65
|
+
await handleDeleteAccountObjects(event, noopLogger);
|
|
76
66
|
|
|
77
67
|
const listCalls = s3Mock.commandCalls(ListObjectsV2Command);
|
|
78
68
|
assert.equal(listCalls.length, 2);
|
|
@@ -83,7 +73,7 @@ describe("handleDeleteAccountObjects", () => {
|
|
|
83
73
|
it("skips the delete call when a page holds no keys", async () => {
|
|
84
74
|
s3Mock.on(ListObjectsV2Command).resolves({ IsTruncated: false });
|
|
85
75
|
|
|
86
|
-
await handleDeleteAccountObjects(event,
|
|
76
|
+
await handleDeleteAccountObjects(event, noopLogger);
|
|
87
77
|
|
|
88
78
|
assert.equal(s3Mock.commandCalls(DeleteObjectsCommand).length, 0);
|
|
89
79
|
});
|
|
@@ -94,7 +84,7 @@ describe("handleDeleteAccountObjects", () => {
|
|
|
94
84
|
|
|
95
85
|
await handleDeleteAccountObjects(
|
|
96
86
|
{ ...event, continuationToken: "tok-mid" },
|
|
97
|
-
|
|
87
|
+
noopLogger,
|
|
98
88
|
() => 5_000,
|
|
99
89
|
);
|
|
100
90
|
|
|
@@ -119,7 +109,7 @@ describe("handleDeleteAccountObjects", () => {
|
|
|
119
109
|
});
|
|
120
110
|
s3Mock.on(DeleteObjectsCommand).resolves({});
|
|
121
111
|
|
|
122
|
-
await handleDeleteAccountObjects(event,
|
|
112
|
+
await handleDeleteAccountObjects(event, noopLogger, () => 120_000);
|
|
123
113
|
|
|
124
114
|
assert.equal(s3Mock.commandCalls(ListObjectsV2Command).length, 1);
|
|
125
115
|
assert.equal(sqsMock.commandCalls(SendMessageCommand).length, 0);
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { beforeEach, describe, it } from "node:test";
|
|
3
3
|
import type { RoleResolution } from "@remit/data-ports/folder-role";
|
|
4
|
-
import
|
|
4
|
+
import { noopLogger } from "@remit/logger-lambda/noop-logger";
|
|
5
5
|
import type { EmptyTrashEvent } from "../events.js";
|
|
6
6
|
import { type EmptyTrashDeps, handleEmptyTrash } from "./empty-trash.js";
|
|
7
7
|
|
|
8
|
-
const noopLog = {
|
|
9
|
-
info: () => {},
|
|
10
|
-
warn: () => {},
|
|
11
|
-
error: () => {},
|
|
12
|
-
debug: () => {},
|
|
13
|
-
fatal: () => {},
|
|
14
|
-
trace: () => {},
|
|
15
|
-
child: () => noopLog,
|
|
16
|
-
} as unknown as Logger;
|
|
17
|
-
|
|
18
8
|
interface Call {
|
|
19
9
|
method: string;
|
|
20
10
|
args: unknown[];
|
|
@@ -224,7 +214,7 @@ describe("handleEmptyTrash", () => {
|
|
|
224
214
|
});
|
|
225
215
|
|
|
226
216
|
it("expunges every server uid and both local rows for each trashed message", async () => {
|
|
227
|
-
await handleEmptyTrash(event,
|
|
217
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
228
218
|
|
|
229
219
|
assert.deepEqual(called("connection.deleteMessages")[0]?.args, [[10, 11]]);
|
|
230
220
|
assert.deepEqual(
|
|
@@ -245,7 +235,7 @@ describe("handleEmptyTrash", () => {
|
|
|
245
235
|
{ messageId: "msg-late", uid: 12, status: "active" },
|
|
246
236
|
];
|
|
247
237
|
|
|
248
|
-
await handleEmptyTrash(event,
|
|
238
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
249
239
|
|
|
250
240
|
assert.deepEqual(
|
|
251
241
|
called("message.delete").map((c) => c.args[0]),
|
|
@@ -259,7 +249,7 @@ describe("handleEmptyTrash", () => {
|
|
|
259
249
|
// exists anywhere, with nothing left to clear the mark.
|
|
260
250
|
h.connection.search = async () => [];
|
|
261
251
|
|
|
262
|
-
await handleEmptyTrash(event,
|
|
252
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
263
253
|
|
|
264
254
|
assert.equal(called("connection.deleteMessages").length, 0);
|
|
265
255
|
assert.equal(called("message.delete").length, 0);
|
|
@@ -274,7 +264,7 @@ describe("handleEmptyTrash", () => {
|
|
|
274
264
|
h.localMessages = [deleting("msg-2", 11)];
|
|
275
265
|
h.connection.search = async () => [];
|
|
276
266
|
|
|
277
|
-
await handleEmptyTrash(event,
|
|
267
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
278
268
|
|
|
279
269
|
assert.equal(called("message.delete").length, 0);
|
|
280
270
|
assert.deepEqual(revertedMessageIds(), ["msg-2"]);
|
|
@@ -288,7 +278,7 @@ describe("handleEmptyTrash", () => {
|
|
|
288
278
|
h.messagesWithoutListingRow = ["msg-expunging"];
|
|
289
279
|
h.connection.search = async () => [];
|
|
290
280
|
|
|
291
|
-
await handleEmptyTrash(event,
|
|
281
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
292
282
|
|
|
293
283
|
assert.deepEqual(revertedMessageIds(), ["msg-1"]);
|
|
294
284
|
});
|
|
@@ -296,7 +286,7 @@ describe("handleEmptyTrash", () => {
|
|
|
296
286
|
it("deletes the message even when it has no thread row", async () => {
|
|
297
287
|
h.threadMessage = false;
|
|
298
288
|
|
|
299
|
-
await handleEmptyTrash(event,
|
|
289
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
300
290
|
|
|
301
291
|
assert.equal(called("message.delete").length, 2);
|
|
302
292
|
assert.equal(called("threadMessage.delete").length, 0);
|
|
@@ -309,7 +299,7 @@ describe("handleEmptyTrash", () => {
|
|
|
309
299
|
deletedAt: Date.now(),
|
|
310
300
|
};
|
|
311
301
|
|
|
312
|
-
await handleEmptyTrash(event,
|
|
302
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
313
303
|
|
|
314
304
|
assert.equal(h.getConnectionCount, 0);
|
|
315
305
|
});
|
|
@@ -317,7 +307,10 @@ describe("handleEmptyTrash", () => {
|
|
|
317
307
|
it("throws when the account no longer exists", async () => {
|
|
318
308
|
h.account = null;
|
|
319
309
|
|
|
320
|
-
await assert.rejects(
|
|
310
|
+
await assert.rejects(
|
|
311
|
+
handleEmptyTrash(event, noopLogger, deps()),
|
|
312
|
+
/not found/,
|
|
313
|
+
);
|
|
321
314
|
});
|
|
322
315
|
|
|
323
316
|
it("acks terminally without connecting when the Trash mailbox was deleted", async () => {
|
|
@@ -325,7 +318,7 @@ describe("handleEmptyTrash", () => {
|
|
|
325
318
|
name: "NotFoundError",
|
|
326
319
|
});
|
|
327
320
|
|
|
328
|
-
await handleEmptyTrash(event,
|
|
321
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
329
322
|
|
|
330
323
|
assert.equal(h.getConnectionCount, 0);
|
|
331
324
|
assert.equal(called("message.delete").length, 0);
|
|
@@ -339,7 +332,7 @@ describe("handleEmptyTrash", () => {
|
|
|
339
332
|
trashMailboxPath: "Trash",
|
|
340
333
|
} as unknown as EmptyTrashEvent;
|
|
341
334
|
|
|
342
|
-
await handleEmptyTrash(unversioned,
|
|
335
|
+
await handleEmptyTrash(unversioned, noopLogger, deps());
|
|
343
336
|
|
|
344
337
|
assert.equal(h.getConnectionCount, 0, "no connection is ever opened");
|
|
345
338
|
assert.equal(called("connection.deleteMessages").length, 0);
|
|
@@ -353,7 +346,7 @@ describe("handleEmptyTrash", () => {
|
|
|
353
346
|
mailbox: { mailboxId: "other-mbx", fullPath: "INBOX/Bak" },
|
|
354
347
|
};
|
|
355
348
|
|
|
356
|
-
await handleEmptyTrash(event,
|
|
349
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
357
350
|
|
|
358
351
|
assert.equal(h.getConnectionCount, 0);
|
|
359
352
|
assert.equal(called("connection.deleteMessages").length, 0);
|
|
@@ -366,7 +359,7 @@ describe("handleEmptyTrash", () => {
|
|
|
366
359
|
mailbox: { mailboxId: "trash-mbx", fullPath: "Trash" },
|
|
367
360
|
};
|
|
368
361
|
|
|
369
|
-
await handleEmptyTrash(event,
|
|
362
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
370
363
|
|
|
371
364
|
assert.equal(called("connection.deleteMessages").length, 0);
|
|
372
365
|
assert.deepEqual(revertedMessageIds(), ["msg-1", "msg-2"]);
|
|
@@ -378,7 +371,7 @@ describe("handleEmptyTrash", () => {
|
|
|
378
371
|
h.connection.openBox = async () => ({ uidvalidity: 77 });
|
|
379
372
|
h.mailbox = { mailboxId: "trash-mbx", uidValidity: 77 };
|
|
380
373
|
|
|
381
|
-
await handleEmptyTrash(event,
|
|
374
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
382
375
|
|
|
383
376
|
assert.equal(called("connection.deleteMessages").length, 0);
|
|
384
377
|
assert.deepEqual(revertedMessageIds(), ["msg-1", "msg-2"]);
|
|
@@ -394,7 +387,7 @@ describe("handleEmptyTrash", () => {
|
|
|
394
387
|
h.connection.openBox = async () => ({ uidvalidity: 77 });
|
|
395
388
|
h.mailbox = { mailboxId: "trash-mbx", uidValidity: 77 };
|
|
396
389
|
|
|
397
|
-
await handleEmptyTrash(event,
|
|
390
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
398
391
|
|
|
399
392
|
assert.deepEqual(revertedMessageIds(), ["msg-1"]);
|
|
400
393
|
assert.deepEqual(undeletedThreadMessageIds(), ["tm-msg-1"]);
|
|
@@ -405,7 +398,7 @@ describe("handleEmptyTrash", () => {
|
|
|
405
398
|
// marked `deleting` hides healthy mail until the user notices.
|
|
406
399
|
h.connection.openBox = async () => ({ uidvalidity: 999 });
|
|
407
400
|
|
|
408
|
-
await handleEmptyTrash(event,
|
|
401
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
409
402
|
|
|
410
403
|
assert.equal(
|
|
411
404
|
(called("mailbox.update")[0]?.args[2] as { cursorState?: string })
|
|
@@ -424,7 +417,7 @@ describe("handleEmptyTrash", () => {
|
|
|
424
417
|
cursorState: "rebuilding",
|
|
425
418
|
};
|
|
426
419
|
|
|
427
|
-
await handleEmptyTrash(event,
|
|
420
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
428
421
|
|
|
429
422
|
assert.equal(h.getConnectionCount, 0);
|
|
430
423
|
assert.equal(called("message.delete").length, 0);
|
|
@@ -437,7 +430,7 @@ describe("handleEmptyTrash", () => {
|
|
|
437
430
|
};
|
|
438
431
|
|
|
439
432
|
await assert.rejects(
|
|
440
|
-
handleEmptyTrash(event,
|
|
433
|
+
handleEmptyTrash(event, noopLogger, deps()),
|
|
441
434
|
/server exploded/,
|
|
442
435
|
);
|
|
443
436
|
|
|
@@ -463,7 +456,7 @@ describe("handleEmptyTrash and an unsettled placement", () => {
|
|
|
463
456
|
movingIntoTrash("msg-moving", 10),
|
|
464
457
|
];
|
|
465
458
|
|
|
466
|
-
await handleEmptyTrash(event,
|
|
459
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
467
460
|
|
|
468
461
|
assert.deepEqual(
|
|
469
462
|
called("message.delete").map((c) => c.args[0]),
|
|
@@ -480,7 +473,7 @@ describe("handleEmptyTrash and an unsettled placement", () => {
|
|
|
480
473
|
// uid is somebody else's.
|
|
481
474
|
h.localMessages = [retryingIntoTrash("msg-retrying", 11)];
|
|
482
475
|
|
|
483
|
-
await handleEmptyTrash(event,
|
|
476
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
484
477
|
|
|
485
478
|
assert.equal(called("message.delete").length, 0);
|
|
486
479
|
assert.equal(called("threadMessage.delete").length, 0);
|
|
@@ -495,7 +488,7 @@ describe("handleEmptyTrash and an unsettled placement", () => {
|
|
|
495
488
|
// `deleting` is hidden from every listing for good.
|
|
496
489
|
h.localMessages = [deleting("msg-1", 10), markedMidMove("msg-marked", 11)];
|
|
497
490
|
|
|
498
|
-
await handleEmptyTrash(event,
|
|
491
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
499
492
|
|
|
500
493
|
assert.deepEqual(
|
|
501
494
|
called("message.delete").map((c) => c.args[0]),
|
|
@@ -522,7 +515,7 @@ describe("handleEmptyTrash and an unsettled placement", () => {
|
|
|
522
515
|
},
|
|
523
516
|
];
|
|
524
517
|
|
|
525
|
-
await handleEmptyTrash(event,
|
|
518
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
526
519
|
|
|
527
520
|
assert.deepEqual(
|
|
528
521
|
called("message.delete").map((c) => c.args[0]),
|
|
@@ -547,7 +540,7 @@ describe("handleEmptyTrash and an unsettled placement", () => {
|
|
|
547
540
|
},
|
|
548
541
|
];
|
|
549
542
|
|
|
550
|
-
await handleEmptyTrash(event,
|
|
543
|
+
await handleEmptyTrash(event, noopLogger, deps());
|
|
551
544
|
|
|
552
545
|
assert.deepEqual(
|
|
553
546
|
called("message.delete").map((c) => c.args[0]),
|