Skip to content

Commit

Permalink
Merge pull request #295 from tloncorp/promote-1.28
Browse files Browse the repository at this point in the history
ops: promote 1.28
  • Loading branch information
arthyn authored Nov 1, 2024
2 parents d250d80 + 4ef22d6 commit d3fdb15
Show file tree
Hide file tree
Showing 3 changed files with 203 additions and 35 deletions.
2 changes: 1 addition & 1 deletion desk/desk.docket-0
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
glob-http+['https://bootstrap.urbit.org/glob-0v7.the2a.smdhg.89k09.6ar0t.gb5te.glob' 0v7.the2a.smdhg.89k09.6ar0t.gb5te]
::glob-ames+~zod^0v0
base+'landscape'
version+[1 27 1]
version+[1 28 0]
website+'https://tlon.io'
license+'MIT'
==
12 changes: 6 additions & 6 deletions desk/lib/contacts/json-1.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,18 @@
++ response
|= n=response:c
^- json
%+ frond -.n
?- -.n
%self (frond self+(contact con.n))
%self (frond contact+(contact con.n))
%page %- pairs
:~ kip+(kip kip.n)
con+(contact con.n)
contact+(contact con.n)
mod+(contact mod.n)
==
%wipe (frond kip+(kip kip.n))
%peer %- pairs
:~ who+(ship who.n)
con+(contact con.n)
contact+(contact con.n)
==
==
--
Expand Down Expand Up @@ -111,11 +112,10 @@
++ value
^- $-(json value:c)
|= jon=json
:: XX is there a way to do it in one go?
::
?~ jon ~
=/ [type=@tas val=json]
%. jon
(ot text+(se %tas) value+json ~)
(ot type+(se %tas) value+json ~)
?+ type !!
%text %. val (ta %text so)
%numb %. val (ta %numb ni)
Expand Down
224 changes: 196 additions & 28 deletions desk/tests/lib/contacts-json-1.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -12,73 +12,241 @@
|= [a=vase b=vase]
(expect-eq b a)
::
++ jen-equal
++ enjs-equal
|= [jon=json txt=@t]
%+ ex-equal
!> (en:json:html jon)
!> txt
::
++ dejs-equal
|* [saf=$-(json *) txt=@t data=*]
%+ ex-equal
!> (saf (need (de:json:html txt)))
!> data
::
++ test-ship
%+ jen-equal
(ship:enjs:j ~sampel-palnet)
'"~sampel-palnet"'
;: weld
%+ enjs-equal
(ship:enjs:j ~sampel-palnet)
'"~sampel-palnet"'
::
%^ dejs-equal ship:dejs:j
'"~sampel-palnet"'
~sampel-palnet
==
++ test-cid
%+ jen-equal
(cid:enjs:j 0v11abc)
'"0v11abc"'
;: weld
%+ enjs-equal
(cid:enjs:j 0v11abc)
'"0v11abc"'
::
%^ dejs-equal cid:dejs:j
'"0v11abc"'
0v11abc
==
++ test-kip
;: weld
%+ jen-equal
%+ enjs-equal
(kip:enjs:j ~sampel-palnet)
'"~sampel-palnet"'
::
%+ jen-equal
%+ enjs-equal
(kip:enjs:j id+0v11abc)
'"0v11abc"'
::
%^ dejs-equal kip:dejs:j
'"~sampel-palnet"'
~sampel-palnet
::
%^ dejs-equal kip:dejs:j
'"0v11abc"'
id+0v11abc
==
++ test-value
;: weld
:: submit null value to delete entry in contacts
::
%^ dejs-equal value:dejs:j
'null'
~
::
%+ jen-equal
(value:enjs:j text+'the lazy fox')
%+ enjs-equal
(value:enjs:j text+'the lazy fox')
'{"type":"text","value":"the lazy fox"}'
::
%+ jen-equal
(value:enjs:j numb+42)
%^ dejs-equal value:dejs:j
'{"type":"text","value":"the lazy fox"}'
text+'the lazy fox'
::
%+ enjs-equal
(value:enjs:j numb+42)
'{"type":"numb","value":42}'
::
%+ jen-equal
%^ dejs-equal value:dejs:j
'{"type":"numb","value":42}'
numb+42
::
%+ enjs-equal
(value:enjs:j date+~2024.9.11)
'{"type":"date","value":"~2024.9.11"}'
::
%+ jen-equal
(value:enjs:j [%tint 0xcafe.babe])
%^ dejs-equal value:dejs:j
'{"type":"date","value":"~2024.9.11"}'
date+~2024.9.11
::
%+ enjs-equal
(value:enjs:j tint+0xcafe.babe)
'{"type":"tint","value":"cafe.babe"}'
::
%+ jen-equal
(value:enjs:j [%ship ~sampel-palnet])
%^ dejs-equal value:dejs:j
'{"type":"tint","value":"cafe.babe"}'
tint+0xcafe.babe
::
%+ enjs-equal
(value:enjs:j ship+~sampel-palnet)
'{"type":"ship","value":"~sampel-palnet"}'
::
%+ jen-equal
(value:enjs:j [%look 'https://ship.io/avatar.png'])
%^ dejs-equal value:dejs:j
'{"type":"ship","value":"~sampel-palnet"}'
ship+~sampel-palnet
::
%+ enjs-equal
(value:enjs:j look+'https://ship.io/avatar.png')
'{"type":"look","value":"https://ship.io/avatar.png"}'
::
%+ jen-equal
(value:enjs:j [%flag [~sampel-palnet %circle]])
%^ dejs-equal value:dejs:j
'{"type":"look","value":"https://ship.io/avatar.png"}'
look+'https://ship.io/avatar.png'
::
%+ enjs-equal
(value:enjs:j flag+[~sampel-palnet %circle])
'{"type":"flag","value":"~sampel-palnet/circle"}'
::
%+ jen-equal
%- value:enjs:j
[%set (silt `(list value)`~[flag/[~sampel-palnet %circle] flag/[~sampel-pardux %square]])]
%^ dejs-equal value:dejs:j
'{"type":"flag","value":"~sampel-palnet/circle"}'
flag+[~sampel-palnet %circle]
::
%+ enjs-equal
%- value:enjs:j
set+(silt `(list value)`~[flag/[~sampel-palnet %circle] flag/[~sampel-pardux %square]])
'{"type":"set","value":[{"type":"flag","value":"~sampel-palnet/circle"},{"type":"flag","value":"~sampel-pardux/square"}]}'
::
%^ dejs-equal value:dejs:j
'{"type":"set","value":[{"type":"flag","value":"~sampel-palnet/circle"},{"type":"flag","value":"~sampel-pardux/square"}]}'
set+(silt `(list value)`~[flag/[~sampel-palnet %circle] flag/[~sampel-pardux %square]])
==
++ test-contact
%+ jen-equal
%- contact:enjs:j
;: weld
%+ enjs-equal
%- contact:enjs:j
%- malt
^- (list [@tas value])
:~ name+text/'Sampel'
surname+text/'Palnet'
==
'{"name":{"type":"text","value":"Sampel"},"surname":{"type":"text","value":"Palnet"}}'
::
%^ dejs-equal contact:dejs:j
'{"name":{"type":"text","value":"Sampel"},"surname":{"type":"text","value":"Palnet"}}'
^- contact:c
%- malt
^- (list [@tas value])
:~ name+text/'Sampel'
surname+text/'Palnet'
==
'{"name":{"type":"text","value":"Sampel"},"surname":{"type":"text","value":"Palnet"}}'
==
++ test-action
=/ con=contact:c
%- malt
^- (list [@tas value])
:~ name+text/'Sampel'
==
=/ mod=contact:c
%- malt
^- (list [@tas value])
:~ surname+text/'Palnet'
==
::
;: weld
%^ dejs-equal action:dejs:j
'{"anon":null}'
[%anon ~]
::
%^ dejs-equal action:dejs:j
'{"self":{"name":{"type":"text","value":"Sampel"}}}'
[%self con]
::
%^ dejs-equal action:dejs:j
'{"page":{"kip":"0v1","contact":{"surname":{"type":"text","value":"Palnet"}}}}'
[%page id+0v1 mod]
::
%^ dejs-equal action:dejs:j
'{"page":{"kip":"~sampel-palnet","contact":{"surname":{"type":"text","value":"Palnet"}}}}'
[%page ~sampel-palnet mod]
::
%^ dejs-equal action:dejs:j
'{"wipe":["0v1", "0v2", "~sampel-palnet"]}'
[%wipe id+0v1 id+0v2 ~sampel-palnet ~]
::
%^ dejs-equal action:dejs:j
'{"meet":["~sampel-palnet", "~master-botnet"]}'
[%meet ~sampel-palnet ~master-botnet ~]
::
%^ dejs-equal action:dejs:j
'{"drop":["~sampel-palnet", "~master-botnet"]}'
[%drop ~sampel-palnet ~master-botnet ~]
::
%^ dejs-equal action:dejs:j
'{"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 d3fdb15

Please sign in to comment.