Skip to content

Commit

Permalink
contacts: fix %response-0 JSON conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
mikolajpp committed Oct 25, 2024
1 parent 505ceb8 commit 984ed9e
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions desk/tests/lib/contacts-json-1.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
}
}
'''
==
--

0 comments on commit 984ed9e

Please sign in to comment.