Skip to content

Commit

Permalink
test: use fixed path in tests (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArniStarkware authored Apr 10, 2024
1 parent b10f7e0 commit 6759071
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions crates/gateway/tests/routing_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@ use pretty_assertions::assert_str_eq;
use rstest::rstest;
use starknet_gateway::gateway::app;
use std::fs;
use std::path::Path;
use tower::ServiceExt;

const TEST_FILES_FOLDER: &str = "./test/gateway/json_files_for_testing";

// TODO(Ayelet): Replace the use of the JSON files with generated instances, then serialize these
// into JSON for testing.
#[rstest]
#[case("./src/json_files_for_testing/declare_v3.json", "DECLARE")]
#[case(
"./src/json_files_for_testing/deploy_account_v3.json",
#[case::declare(&Path::new(TEST_FILES_FOLDER).join("declare_v3.json"), "DECLARE")]
#[case::deploy_account(
&Path::new(TEST_FILES_FOLDER).join("deploy_account_v3.json"),
"DEPLOY_ACCOUNT"
)]
#[case("./src/json_files_for_testing/invoke_v3.json", "INVOKE")]
#[case::invoke(&Path::new(TEST_FILES_FOLDER).join("invoke_v3.json"), "INVOKE")]
#[tokio::test]
async fn test_routes(#[case] json_file_path: &str, #[case] expected_response: &str) {
async fn test_routes(#[case] json_file_path: &Path, #[case] expected_response: &str) {
let tx_json = fs::read_to_string(json_file_path).unwrap();
let request = Request::post("/add_transaction")
.header("content-type", "application/json")
Expand Down

0 comments on commit 6759071

Please sign in to comment.