Skip to content

Commit

Permalink
fixup! e2e test for jsonb values
Browse files Browse the repository at this point in the history
  • Loading branch information
alco committed Nov 13, 2023
1 parent b734a3e commit c1d63d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions e2e/tests/03.19_node_satellite_can_sync_json.lux
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@
#[invoke node_get_json "row3" 500]
[invoke node_get_jsonb "row3" "{ a: true, b: [ 1, 2 ] }"]

[invoke node_write_json "row4" "[ 1, { a: \"foo\" }, true ]" "'bar'"]
#[invoke node_get_json "row4" "[ 1, { a: \"foo\" }, true ]"]
[invoke node_get_jsonb "row4" "'bar'"]
[invoke node_write_json "row4" "'bar'" "[ 1, { a: 'foo' }, true ]"]
# [invoke node_get_json "row4" "'bar'"]
[invoke node_get_jsonb "row4" "[ 1, { a: 'foo' }, true ]"]

[invoke node_write_json "row5" "null" "[\"it's ⚡\", {}, \"\\u2603 under \\u2602\"]"]
[invoke node_get_jsonb "row5" "[ \"it's ⚡\", {}, '☃ under ☂' ]"]

[shell pg_1]
[invoke wait-for "SELECT * FROM public.jsons;" "row4" 10 $psql]
Expand All @@ -68,7 +71,8 @@
??row1 | [{"a": 1}, {"b": 5, "d": false}]
??row2 | <NULL>
??row3 | {"a": true, "b": [1, 2]}
??row4 | "bar"
??row4 | [1, {"a": "foo"}, true]
??row5 | ["it's ⚡", {}, "☃ under ☂"]

# Start a new Satellite client and verify that it receives all rows
[invoke setup_client 2 electric_1 5133]
Expand All @@ -95,8 +99,10 @@
#[invoke node_get_json "row3" 500]
[invoke node_get_jsonb "row3" "{ a: true, b: [ 1, 2 ] }"]

#[invoke node_get_json "row4" "[ 1, { a: \"foo\" }, true ]"]
[invoke node_get_jsonb "row4" "'bar'"]
#[invoke node_get_json "row4" "'bar'"]
[invoke node_get_jsonb "row4" "[ 1, { a: 'foo' }, true ]"]

[invoke node_get_jsonb "row5" "[ \"it's ⚡\", {}, '☃ under ☂' ]"]

[cleanup]
[invoke teardown]
2 changes: 1 addition & 1 deletion e2e/tests/_satellite_macros.luxinc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
# Can write valid JSON to the DB
!await client.write_json(db, '${id}', ${json_value}, ${jsonb_value})
#??{ id: '${id}', js: ${json_value}, jsb: ${jsonb_value} }
??{ id: '${id}', jsb: ${jsonb_value} }
# ??{ id: '${id}', jsb: ${jsonb_value} }
??$node
[endmacro]

Expand Down

0 comments on commit c1d63d4

Please sign in to comment.