1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use crate::ValueWrapper;

pub fn get_governance_initial_state() -> ValueWrapper {
    ValueWrapper(serde_json::json!({
        "members": [],
        "roles": [
          {
            "namespace": "",
            "role": "WITNESS",
            "schema": {
                "ID": "governance"
            },
            "who": "MEMBERS"
          }
        ],
        "schemas": [],
        "policies": [
          {
            "id": "governance",
            "approve": {
              "quorum": "MAJORITY"
            },
            "evaluate": {
              "quorum": "MAJORITY"
            },
            "validate": {
              "quorum": "MAJORITY"
            }
          }
        ]
    }))
}

#[cfg(test)]
mod test {
    use crate::commons::schema_handler::{get_governance_schema, Schema};

    #[test]
    fn compile_initial_state() {
        let gov_schema = get_governance_schema();
        let schema = Schema::compile(&gov_schema).expect("gov schema compiles");
        let init_state = super::get_governance_initial_state();
        assert!(schema.validate(&init_state.0))
        // let schema =
    }
}