Factored out sorting function from visualize, adding test for visualize with data, updated test_sql_to_json to create a temp folder before tests