From 984ed9e9524b3be74eb7c02364e3d40081fb1846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Paraniak?= Date: Fri, 25 Oct 2024 22:58:19 +0800 Subject: [PATCH] contacts: fix %response-0 JSON conversion --- desk/tests/lib/contacts-json-1.hoon | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/desk/tests/lib/contacts-json-1.hoon b/desk/tests/lib/contacts-json-1.hoon index 155ec31..8ac7a50 100644 --- a/desk/tests/lib/contacts-json-1.hoon +++ b/desk/tests/lib/contacts-json-1.hoon @@ -195,4 +195,53 @@ '{"snub":["~sampel-palnet", "~master-botnet"]}' [%snub ~sampel-palnet ~master-botnet ~] == +++ test-response + =/ con=contact:c + %- malt + ^- (list [@tas value]) + :~ name+text/'Sampel' + == + =/ mod=contact:c + %- malt + ^- (list [@tas value]) + :~ surname+text/'Palnet' + == + ;: weld + %+ enjs-equal + (response:enjs:j [%self con]) + '{"self":{"contact":{"name":{"type":"text","value":"Sampel"}}}}' + :: + %+ enjs-equal + (response:enjs:j [%page id+0v1 con mod]) + ^~ %- en:json:html %- need %- de:json:html + ''' + { + "page": { + "mod":{"surname":{"type":"text","value":"Palnet"}}, + "kip":"0v1", + "contact":{"name":{"type":"text","value":"Sampel"}} + } + } + ''' + :: + %+ enjs-equal + (response:enjs:j [%wipe id+0v1]) + '{"wipe":{"kip":"0v1"}}' + :: + %+ enjs-equal + (response:enjs:j [%wipe ~sampel-palnet]) + '{"wipe":{"kip":"~sampel-palnet"}}' + :: + %+ enjs-equal + (response:enjs:j [%peer ~sampel-palnet con]) + ^~ %- en:json:html %- need %- de:json:html + ''' + { + "peer": { + "who":"~sampel-palnet", + "contact":{"name":{"type":"text","value":"Sampel"}} + } + } + ''' + == --