summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-03-08 08:40:59 -0300
committerEuAndreh <eu@euandre.org>2024-03-08 08:40:59 -0300
commitee882ae2ba0275ef32ff7fadcd7414458e273e1c (patch)
treeec16930784e73dbfe10f4f0398b152d30795cf4e /tests
parentsrc/web.mjs: Move logging and interceptors to the beginning of the file (diff)
downloadpapod-ee882ae2ba0275ef32ff7fadcd7414458e273e1c.tar.gz
papod-ee882ae2ba0275ef32ff7fadcd7414458e273e1c.tar.xz
src/utils.mjs: Add dissoc()
Diffstat (limited to 'tests')
-rw-r--r--tests/js/utils.mjs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/js/utils.mjs b/tests/js/utils.mjs
index d8a8ded..33bdac2 100644
--- a/tests/js/utils.mjs
+++ b/tests/js/utils.mjs
@@ -5,6 +5,7 @@ import {
keys,
difference,
assocIn,
+ dissoc,
getIn,
findFirst,
partial,
@@ -123,6 +124,22 @@ const test_assocIn = async t => {
});
};
+const test_dissoc = async t => {
+ t.start("dissoc()");
+
+ await t.test("empty values", () => {
+ assert.deepEqual(dissoc({}, "k"), {});
+ });
+
+ await t.test("noop when key does not exist", () => {
+ assert.deepEqual(dissoc({ a: 1 }, "b"), { a: 1 });
+ });
+
+ await t.test("removes the key", () => {
+ assert.deepEqual(dissoc({ a: 1, b: 2}, "b"), { a: 1 });
+ });
+};
+
const test_getIn = async t => {
t.start("getIn()");
@@ -347,6 +364,7 @@ await runner.runTests([
test_keys,
test_difference,
test_assocIn,
+ test_dissoc,
test_getIn,
test_findFirst,
test_partial,