Open
Description
Is there a recommended way of debugging during tests?
I found myself needing to debug something and ended up using the following to achieve what I needed.
SELECT
row_eq (
$$
SELECT json_agg(json_build_object(
'user_id', user_id,
'account_id', account_id,
'account_role', account_role
))::text FROM basejump.account_user WHERE account_id = 'd126ecef-35f6-4b5d-9f28-d9f00a9fb46f';
$$,
ROW (json_build_object('user_id', 'log')::text),
'LOG'
);
This fails a test and logs the contents of the table.
# Failed test 1: "LOG"
# have: ("[{""user_id"" : ""2ea7443e-a7b8-45e9-87c1-b40cb7f1f37d"", ""account_id"" : ""d126ecef-35f6-4b5d-9f28-d9f00a9fb46f"", ""account_role"" : ""owner""}]")
# want: ("{""user_id"" : ""log""}")
Is there a better way to log data in tests?
Metadata
Metadata
Assignees
Labels
No labels