@remit/backend 0.0.118 → 0.0.119
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 -1
- package/src/handlers/address.test.ts +38 -0
package/package.json
CHANGED
|
@@ -181,6 +181,44 @@ const clientHolding = (
|
|
|
181
181
|
},
|
|
182
182
|
}) as unknown as RemitClient;
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* The never-spam grant (#605) travels the same route every other flag does. The
|
|
186
|
+
* exclusivity against `blocked` is not asserted here: it lives in the repo's
|
|
187
|
+
* merge fold, the only place that sees both keys at once.
|
|
188
|
+
*/
|
|
189
|
+
describe("AddressDetailOperations_updateAddress never-spam (#605)", () => {
|
|
190
|
+
it("forwards the grant to the merge patch and hands it back on the address", async () => {
|
|
191
|
+
const seen: FlagsMergePatch[] = [];
|
|
192
|
+
setClient(clientHolding(address({ flags: {} }), seen));
|
|
193
|
+
|
|
194
|
+
const response = await updateAddress(
|
|
195
|
+
updateContextFor({ flags: { neverSpam: { value: true, setAt: 20 } } }),
|
|
196
|
+
eventFor(SUB),
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
assert.deepEqual(seen, [{ neverSpam: { value: true, setAt: 20 } }]);
|
|
200
|
+
assert.deepEqual(response.flags.neverSpam, { value: true, setAt: 20 });
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it("clears the grant by naming the key, the removal form every flag shares", async () => {
|
|
204
|
+
const seen: FlagsMergePatch[] = [];
|
|
205
|
+
setClient(
|
|
206
|
+
clientHolding(
|
|
207
|
+
address({ flags: { neverSpam: { value: true, setAt: 10 } } }),
|
|
208
|
+
seen,
|
|
209
|
+
),
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
const response = await updateAddress(
|
|
213
|
+
updateContextFor({ clearFlags: ["neverSpam"] }),
|
|
214
|
+
eventFor(SUB),
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
assert.deepEqual(seen, [{ neverSpam: null }]);
|
|
218
|
+
assert.equal(response.flags.neverSpam, undefined);
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
|
|
184
222
|
describe("AddressDetailOperations_updateAddress removing a flag (#615)", () => {
|
|
185
223
|
it("clears the category override, which has no false-equivalent value to send", async () => {
|
|
186
224
|
const seen: FlagsMergePatch[] = [];
|