Skip to content

Commit 8ff3837

Browse files
author
hhaensel
committed
adapt json rendering tests to JSON v1.5
1 parent 177d0e6 commit 8ff3837

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

test/tests_Assets.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
using Genie, Genie.Assets
1515
Genie.config.websockets_port = 8000 # state gets affected depending on how tests are run -- let's set it explicitly
1616

17-
@test strip(js_settings()) == strip("window.Genie = {};\nGenie.Settings = {\"websockets_exposed_port\":window.location.port,\"server_host\":\"127.0.0.1\",\"webchannels_autosubscribe\":true,\"webchannels_reconnect_delay\":500,\"env\":\"dev\",\"webchannels_eval_command\":\">eval:\",\"webchannels_alert_overlay\":false,\"websockets_host\":\"127.0.0.1\",\"webchannels_show_alert\":true,\"webthreads_js_file\":\"webthreads.js\",\"webchannels_base64_marker\":\"base64:\",\"webchannels_unsubscribe_channel\":\"unsubscribe\",\"webthreads_default_route\":\"____\",\"webchannels_subscription_trials\":4,\"webchannels_subscribe_channel\":\"subscribe\",\"server_port\":8000,\"webchannels_keepalive_frequency\":30000,\"websockets_exposed_host\":window.location.hostname,\"webchannels_connection_attempts\":10,\"base_path\":\"\",\"websockets_protocol\":window.location.protocol.replace('http', 'ws'),\"webthreads_pull_route\":\"pull\",\"webchannels_default_route\":\"____\",\"webchannels_server_gone_alert_timeout\":10000,\"webchannels_timeout\":1000,\"webthreads_push_route\":\"push\",\"websockets_port\":8000,\"websockets_base_path\":\"\"};")
17+
@test strip(js_settings()) == strip("window.Genie = {};\nGenie.Settings = {\"websockets_exposed_port\":window.location.port,\"server_host\":\"127.0.0.1\",\"webchannels_autosubscribe\":true,\"webchannels_reconnect_delay\":500,\"env\":\"dev\",\"webchannels_eval_command\":\">eval:\",\"webchannels_alert_overlay\":false,\"websockets_host\":\"127.0.0.1\",\"webchannels_show_alert\":true,\"webthreads_js_file\":\"webthreads.js\",\"webchannels_base64_marker\":\"base64:\",\"webchannels_unsubscribe_channel\":\"unsubscribe\",\"webthreads_default_route\":\"____\",\"webchannels_subscription_trials\":4,\"webchannels_subscribe_channel\":\"subscribe\",\"server_port\":8000,\"webchannels_keepalive_frequency\":30000,\"websockets_exposed_host\":window.location.hostname,\"webchannels_connection_attempts\":10,\"base_path\":\"\",\"websockets_protocol\":window.location.protocol.replace('http', 'ws'),\"webthreads_pull_route\":\"pull\",\"webchannels_default_route\":\"____\",\"webchannels_server_gone_alert_timeout\":10000,\"webchannels_timeout\":1000,\"webthreads_push_route\":\"push\",\"websockets_port\":8000,\"websockets_base_path\":\"\"};") ||
18+
strip(js_settings()) == strip("window.Genie = {};\nGenie.Settings = {\"base_path\":\"\",\"env\":\"dev\",\"server_host\":\"127.0.0.1\",\"server_port\":8000,\"webchannels_alert_overlay\":false,\"webchannels_autosubscribe\":true,\"webchannels_base64_marker\":\"base64:\",\"webchannels_connection_attempts\":10,\"webchannels_default_route\":\"____\",\"webchannels_eval_command\":\">eval:\",\"webchannels_keepalive_frequency\":30000,\"webchannels_reconnect_delay\":500,\"webchannels_server_gone_alert_timeout\":10000,\"webchannels_show_alert\":true,\"webchannels_subscribe_channel\":\"subscribe\",\"webchannels_subscription_trials\":4,\"webchannels_timeout\":1000,\"webchannels_unsubscribe_channel\":\"unsubscribe\",\"websockets_base_path\":\"\",\"websockets_exposed_host\":window.location.hostname,\"websockets_exposed_port\":window.location.port,\"websockets_host\":\"127.0.0.1\",\"websockets_port\":null,\"websockets_protocol\":window.location.protocol.replace('http', 'ws'),\"webthreads_default_route\":\"____\",\"webthreads_js_file\":\"webthreads.js\",\"webthreads_pull_route\":\"pull\",\"webthreads_push_route\":\"push\"};")
1819
end
1920

2021
@safetestset "Embedded assets" begin

test/tests_json_rendering.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
r = json(Genie.Renderer.Path(viewfile[1]), root = "greetings", greetings = words)
1717

18-
@test String(r.body) == """{"greetings":{"en":"Hello","it":"Ciao","pt":"Ola","es":"Hola"}}"""
18+
json_str = String(r.body)
19+
@test json_str == """{"greetings":{"en":"Hello","it":"Ciao","pt":"Ola","es":"Hola"}}""" ||
20+
json_str == """{"greetings":{"en":"Hello","es":"Hola","it":"Ciao","pt":"Ola"}]"""
1921

2022
Genie.Renderer.clear_task_storage()
2123
end;

0 commit comments

Comments
 (0)