@remit/imap-worker 0.0.8 → 0.0.9
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
|
@@ -147,6 +147,45 @@ describe("drainPendingFlagPushes — periodic per-mailbox re-arm (issue #1273)",
|
|
|
147
147
|
assert.equal(emitted.length, 2);
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Markers persisted before the system-flag wire-format fix carry the
|
|
152
|
+
* unprefixed spelling (`Seen`, not `\Seen`) the enum emitter used to
|
|
153
|
+
* produce. The drain re-arms from the stored `marker.flagName` and never
|
|
154
|
+
* from the enum, and `handleFlagPush` threads that same value through
|
|
155
|
+
* `find`/`updateState`/`delete` — so a marker written under the old
|
|
156
|
+
* spelling still matches itself and drains to completion. No migration,
|
|
157
|
+
* no orphans.
|
|
158
|
+
*/
|
|
159
|
+
it("re-arms a marker persisted under the pre-fix unprefixed spelling verbatim", async () => {
|
|
160
|
+
const markerService = {
|
|
161
|
+
listByMailboxId: async () => [
|
|
162
|
+
marker({ messageId: "legacy-msg", flagName: "Seen" }),
|
|
163
|
+
marker({ messageId: "legacy-star", flagName: "Flagged" }),
|
|
164
|
+
],
|
|
165
|
+
} as unknown as IMessageFlagPushRepository;
|
|
166
|
+
|
|
167
|
+
const emitted: Array<{ messageId: string; flagName: string }> = [];
|
|
168
|
+
const { log } = buildLogger();
|
|
169
|
+
|
|
170
|
+
await drainPendingFlagPushes(
|
|
171
|
+
markerService,
|
|
172
|
+
account,
|
|
173
|
+
"mbx-1",
|
|
174
|
+
log,
|
|
175
|
+
async (event) => {
|
|
176
|
+
emitted.push(event as unknown as (typeof emitted)[number]);
|
|
177
|
+
},
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
assert.deepEqual(
|
|
181
|
+
emitted.map((e) => [e.messageId, e.flagName]),
|
|
182
|
+
[
|
|
183
|
+
["legacy-msg", "Seen"],
|
|
184
|
+
["legacy-star", "Flagged"],
|
|
185
|
+
],
|
|
186
|
+
);
|
|
187
|
+
});
|
|
188
|
+
|
|
150
189
|
it("a re-arm (SQS) failure is caught per-marker and logged loudly — never thrown", async () => {
|
|
151
190
|
const markerService = {
|
|
152
191
|
listByMailboxId: async () => [marker()],
|