solana_test/
config.rs

1//! SolanaTest Config
2//!
3//! See instructions in `commands.rs` to specify the path to your
4//! application's configuration file and/or command-line options
5//! for specifying it.
6
7use serde::{Deserialize, Serialize};
8use std::env;
9use std::path::PathBuf;
10
11/// SolanaTest Configuration
12#[derive(Clone, Debug, Deserialize, Serialize)]
13#[serde(deny_unknown_fields)]
14pub struct SolanaTestConfig {
15    pub init: InitSection,
16}
17
18impl Default for SolanaTestConfig {
19    fn default() -> Self {
20        Self {
21            init: InitSection::default(),
22        }
23    }
24}
25
26#[derive(Clone, Debug, Deserialize, Serialize)]
27#[serde(deny_unknown_fields)]
28pub struct InitSection {
29    // Path to project
30    pub path: PathBuf,
31    // URL to POC Framework
32    pub framework_repo_url: String,
33    // Path to save generated tests boilerplate
34    pub test_file_path: PathBuf,
35    // Framework name
36    pub framework_name: String,
37    // Framework branch to be used
38    pub framework_branch: String,
39    // Should initialize with anchor
40    pub is_anchor: Option<bool>,
41}
42
43impl Default for InitSection {
44    fn default() -> Self {
45        let current_dir = env::current_dir().expect("Cannot determine current dir");
46        Self {
47            path: current_dir.clone(),
48            test_file_path: current_dir.clone().join("tests/genereted_test.rs"),
49            framework_repo_url: String::from(
50                "https://github.com/lowprivuser/solana-test-framework",
51            ),
52            framework_name: String::from("solana-test-framework"),
53            framework_branch: String::from("main"),
54            is_anchor: None,
55        }
56    }
57}