Skip to content
Snippets Groups Projects
Select Git revision
  • f46e15c2a4ab799b1413eab08f84991027aa49fb
  • master default protected
  • chrome-manifest-v3
  • feature/migrate-cordova-13
  • feat/improve-network-scan
  • feat/force-migration-check
  • develop
  • feature/encrypted_comment
  • feature/android_api_19
  • gitlab_migration_1
  • rml8
  • v1.7.15-rc1
  • v1.7.14
  • v1.7.13
  • v1.7.12
  • v1.7.11
  • v1.7.10
  • v1.7.9
  • v1.7.8
  • v1.7.7
  • v1.7.6
  • v1.7.5
  • v1.7.4
  • v1.7.3
  • v1.7.2
  • v1.7.1
  • v1.7.0
  • v1.7.0-rc2
  • v1.7.0-rc1
  • v1.6.12
  • v1.6.11
31 results

wallet-controllers.js

Blame
  • integration_tests.rs 19.80 KiB
    // Copyright 2021 Axiom-Team
    //
    // This file is part of Duniter-v2S.
    //
    // Duniter-v2S is free software: you can redistribute it and/or modify
    // it under the terms of the GNU Affero General Public License as published by
    // the Free Software Foundation, version 3 of the License.
    //
    // Duniter-v2S is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    // GNU Affero General Public License for more details.
    //
    // You should have received a copy of the GNU Affero General Public License
    // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>.
    
    mod common;
    
    use common::*;
    use frame_support::traits::{Get, PalletInfo, StorageInfo, StorageInfoTrait};
    use frame_support::{assert_noop, assert_ok};
    use frame_support::{StorageHasher, Twox128};
    use gdev_runtime::*;
    use sp_keyring::AccountKeyring;
    use sp_runtime::MultiAddress;
    
    #[test]
    fn verify_treasury_account() {
        println!("{}", Treasury::account_id());
    }
    
    #[test]
    fn verify_pallet_prefixes() {
        let prefix = |pallet_name, storage_name| {
            let mut res = [0u8; 32];
            res[0..16].copy_from_slice(&Twox128::hash(pallet_name));
            res[16..32].copy_from_slice(&Twox128::hash(storage_name));
            res.to_vec()
        };
        assert_eq!(
            <Timestamp as StorageInfoTrait>::storage_info(),
            vec![
                StorageInfo {
                    pallet_name: b"Timestamp".to_vec(),
                    storage_name: b"Now".to_vec(),
                    prefix: prefix(b"Timestamp", b"Now"),
                    max_values: Some(1),
                    max_size: Some(8),
                },
                StorageInfo {
                    pallet_name: b"Timestamp".to_vec(),
                    storage_name: b"DidUpdate".to_vec(),
                    prefix: prefix(b"Timestamp", b"DidUpdate"),
                    max_values: Some(1),
                    max_size: Some(1),
                }
            ]
        );
    }
    
    #[test]
    fn verify_pallet_indices() {
        fn is_pallet_index<P: 'static>(index: usize) {
            assert_eq!(
                <Runtime as frame_system::Config>::PalletInfo::index::<P>(),
                Some(index)
            );
        }
        is_pallet_index::<System>(0);
    }