Skip to content

Commit

Permalink
snap: use JSON.stringify instead of printjson
Browse files Browse the repository at this point in the history
with `mongosh`, printjson is just an alias to print, causing outputs to
not be in JSON, thus `jq` failing.

See `printjson.help`, `print.help`.
  • Loading branch information
debdutdeb committed Nov 12, 2024
1 parent 69b5a9c commit 96976fb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions snap/snap.bats
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ setup_file() {
assert_success
wait_for_server
run --separate-stderr /snap/rocketchat-server/current/usr/bin/mongosh --quiet --eval '
printjson(
print(JSON.stringify(
db.getSiblingDB("parties").rocketchat_settings.findOne({
_id: "Accounts_TwoFactorAuthentication_Enabled"
}, {
Expand All @@ -75,7 +75,7 @@ setup_file() {
processEnvValue: 1,
_id: 0
})
)
))
'
assert_success
assert_field_equal value 'false'
Expand All @@ -90,7 +90,7 @@ setup_file() {
run --separate-stderr /snap/rocketchat-server/current/usr/bin/mongosh --quiet --eval '
config = db.getSiblingDB("local").system.replset.findOne( { "_id": "rs0" } );
config.members[0].host = "localhost:27018";
db.getSiblingDB("local").system.replset.updateOne( { "_id": "rs0" }, { $set: config } );
print(JSON.stringify(db.getSiblingDB("local").system.replset.updateOne( { "_id": "rs0" }, { $set: config } )));
'
assert_success
assert_field_equal acknowledged 'true'
Expand Down

0 comments on commit 96976fb

Please sign in to comment.