From d83e090d4ef86fa5db586abc4b3ab1d5ce27ff1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Paraniak?= Date: Wed, 30 Oct 2024 23:19:02 +0800 Subject: [PATCH] contacts: handle null value in $action %edit --- desk/lib/contacts/json-1.hoon | 3 +-- desk/tests/lib/contacts-json-1.hoon | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/desk/lib/contacts/json-1.hoon b/desk/lib/contacts/json-1.hoon index cbf368e..a65fc33 100644 --- a/desk/lib/contacts/json-1.hoon +++ b/desk/lib/contacts/json-1.hoon @@ -112,8 +112,7 @@ ++ value ^- $-(json value:c) |= jon=json - :: XX is there a way to do it in one go? - :: + ?~ jon ~ =/ [type=@tas val=json] %. jon (ot type+(se %tas) value+json ~) diff --git a/desk/tests/lib/contacts-json-1.hoon b/desk/tests/lib/contacts-json-1.hoon index 6f72b06..2c9766e 100644 --- a/desk/tests/lib/contacts-json-1.hoon +++ b/desk/tests/lib/contacts-json-1.hoon @@ -64,6 +64,11 @@ == ++ test-value ;: weld + :: submit null value to delete entry in contacts + :: + %^ dejs-equal value:dejs:j + 'null' + ~ :: %+ enjs-equal (value:enjs:j text+'the lazy fox')