mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-20 21:31:32 +03:00
tests: patch eyre tests for channel modes
Since the tests call arms from eyre directly, these had to be updated alongside it, to now specify the channel mode in light of which the request should be parsed. Includes smoke tests for jam-mode channels.
This commit is contained in:
parent
171142fd31
commit
4bc88f2825
@ -643,17 +643,30 @@
|
|||||||
!> (rush '192.168.1.1' simplified-url-parser:eyre-gate)
|
!> (rush '192.168.1.1' simplified-url-parser:eyre-gate)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ test-parse-channel-request
|
++ test-parse-channel-request-jam
|
||||||
;: weld
|
;: weld
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> `[%ack 5]~
|
!> &+[%ack 5]~
|
||||||
!> %- parse-channel-request:eyre-gate
|
!> %+ parse-channel-request:eyre-gate %jam
|
||||||
(need (de-json:html '[{"action": "ack", "event-id": 5}]'))
|
(as-octs:mimes:html (scot %uw (jam [%ack 5]~)))
|
||||||
::
|
::
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> `[%poke 0 ~nec %app1 %app-type [%n '5']]~
|
!> |+'invalid request data'
|
||||||
!> %- parse-channel-request:eyre-gate
|
!> %+ parse-channel-request:eyre-gate %jam
|
||||||
%- need %- de-json:html
|
(as-octs:mimes:html (scot %uw (jam [%not %a %chanreq %list])))
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ test-parse-channel-request-json
|
||||||
|
;: weld
|
||||||
|
%+ expect-eq
|
||||||
|
!> &+[%ack 5]~
|
||||||
|
!> %+ parse-channel-request:eyre-gate %json
|
||||||
|
(as-octs:mimes:html '[{"action": "ack", "event-id": 5}]')
|
||||||
|
::
|
||||||
|
%+ expect-eq
|
||||||
|
!> &+[%poke-json 0 ~nec %app1 %app-type [%n '5']]~
|
||||||
|
!> %+ parse-channel-request:eyre-gate %json
|
||||||
|
%- as-octs:mimes:html
|
||||||
'''
|
'''
|
||||||
[{"action": "poke",
|
[{"action": "poke",
|
||||||
"id": 0,
|
"id": 0,
|
||||||
@ -664,9 +677,9 @@
|
|||||||
'''
|
'''
|
||||||
::
|
::
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> `[%subscribe 1 ~sampyl-sipnym %hall /this/path]~
|
!> &+[%subscribe 1 ~sampyl-sipnym %hall /this/path]~
|
||||||
!> %- parse-channel-request:eyre-gate
|
!> %+ parse-channel-request:eyre-gate %json
|
||||||
%- need %- de-json:html
|
%- as-octs:mimes:html
|
||||||
'''
|
'''
|
||||||
[{"action": "subscribe",
|
[{"action": "subscribe",
|
||||||
"id": 1,
|
"id": 1,
|
||||||
@ -676,9 +689,9 @@
|
|||||||
'''
|
'''
|
||||||
::
|
::
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> `[%unsubscribe 2 1]~
|
!> &+[%unsubscribe 2 1]~
|
||||||
!> %- parse-channel-request:eyre-gate
|
!> %+ parse-channel-request:eyre-gate %json
|
||||||
%- need %- de-json:html
|
%- as-octs:mimes:html
|
||||||
'''
|
'''
|
||||||
[{"action": "unsubscribe",
|
[{"action": "unsubscribe",
|
||||||
"id": 2,
|
"id": 2,
|
||||||
@ -686,30 +699,30 @@
|
|||||||
'''
|
'''
|
||||||
::
|
::
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> ~
|
!> |+'invalid channel json'
|
||||||
!> %- parse-channel-request:eyre-gate
|
!> %+ parse-channel-request:eyre-gate %json
|
||||||
%- need %- de-json:html
|
%- as-octs:mimes:html
|
||||||
'[{"noaction": "noaction"}]'
|
'[{"noaction": "noaction"}]'
|
||||||
::
|
::
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> ~
|
!> |+'invalid channel json'
|
||||||
!> %- parse-channel-request:eyre-gate
|
!> %+ parse-channel-request:eyre-gate %json
|
||||||
%- need %- de-json:html
|
%- as-octs:mimes:html
|
||||||
'[{"action": "bad-action"}]'
|
'[{"action": "bad-action"}]'
|
||||||
::
|
::
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> ~
|
!> |+'invalid channel json'
|
||||||
!> %- parse-channel-request:eyre-gate
|
!> %+ parse-channel-request:eyre-gate %json
|
||||||
%- need %- de-json:html
|
%- as-octs:mimes:html
|
||||||
'[{"action": "ack", "event-id": 5}, {"action": "bad-action"}]'
|
'[{"action": "ack", "event-id": 5}, {"action": "bad-action"}]'
|
||||||
::
|
::
|
||||||
%+ expect-eq
|
%+ expect-eq
|
||||||
!> :- ~
|
!> :- %&
|
||||||
:~ [%ack 9]
|
:~ [%ack 9]
|
||||||
[%poke 3 ~bud %wut %wut-type [%a [%n '2'] [%n '1'] ~]]
|
[%poke-json 3 ~bud %wut %wut-type [%a [%n '2'] [%n '1'] ~]]
|
||||||
==
|
==
|
||||||
!> %- parse-channel-request:eyre-gate
|
!> %+ parse-channel-request:eyre-gate %json
|
||||||
%- need %- de-json:html
|
%- as-octs:mimes:html
|
||||||
'''
|
'''
|
||||||
[{"action": "ack", "event-id": 9},
|
[{"action": "ack", "event-id": 9},
|
||||||
{"action": "poke",
|
{"action": "poke",
|
||||||
|
Loading…
Reference in New Issue
Block a user