()
| 662 | |
| 663 | #[wasm_bindgen_test] |
| 664 | fn test_mappings() { |
| 665 | // Get the mappings from the program |
| 666 | let program = Program::get_credits_program(); |
| 667 | let mappings = program.get_mappings().unwrap(); |
| 668 | |
| 669 | let expected = array![ |
| 670 | object! { |
| 671 | "name": "committee", |
| 672 | "key_type": "address", |
| 673 | "value_type": "committee_state", |
| 674 | }, |
| 675 | object! { |
| 676 | "name": "delegated", |
| 677 | "key_type": "address", |
| 678 | "value_type": "u64", |
| 679 | }, |
| 680 | object! { |
| 681 | "name": "metadata", |
| 682 | "key_type": "address", |
| 683 | "value_type": "u32", |
| 684 | }, |
| 685 | object! { |
| 686 | "name": "bonded", |
| 687 | "key_type": "address", |
| 688 | "value_type": "bond_state", |
| 689 | }, |
| 690 | object! { |
| 691 | "name": "unbonding", |
| 692 | "key_type": "address", |
| 693 | "value_type": "unbond_state", |
| 694 | }, |
| 695 | object! { |
| 696 | "name": "account", |
| 697 | "key_type": "address", |
| 698 | "value_type": "u64", |
| 699 | }, |
| 700 | object! { |
| 701 | "name": "withdraw", |
| 702 | "key_type": "address", |
| 703 | "value_type": "address", |
| 704 | }, |
| 705 | object! { |
| 706 | "name":"pool", |
| 707 | "key_type":"address", |
| 708 | "value_type":"u64", |
| 709 | } |
| 710 | ]; |
| 711 | |
| 712 | // Assert that the mappings are equal |
| 713 | assert_eq!(format!("{:?}", mappings.to_vec()), format!("{:?}", expected.to_vec())); |
| 714 | |
| 715 | // Assert a program with no mappings providers an empty array |
| 716 | let program = Program::from_string(TOKEN_ISSUE).unwrap(); |
| 717 | let mappings = program.get_mappings().unwrap(); |
| 718 | let empty: Vec<JsValue> = vec![]; |
| 719 | assert_eq!(mappings.to_vec(), empty); |
| 720 | } |
| 721 |
nothing calls this directly
no test coverage detected