text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  var _testingPairs = _interopRequireDefault(require("@polkadot/keyring/testingPairs"));
  
  var _types = require("@polkadot/types");
  
  var _util = require("@polkadot/util");
  
  var _Metadata = _interopRequireDefault(require("../../../Metadata"));
  
  var _static = _interopRequireDefault(require("../../../Metadata/static"));
  
  var _Decorated = _interopRequireDefault(require("../../Decorated"));
  
  // Copyright 2017-2020 @polkadot/metadata authors & contributors
  // SPDX-License-Identifier: Apache-2.0
  const keyring = (0, _testingPairs.default)({
    type: 'ed25519'
  });
  describe('fromMetadata', () => {
    describe('latest', () => {
      const registry = new _types.TypeRegistry();
      const metadata = new _Metadata.default(registry, _static.default);
      registry.setMetadata(metadata);
      const decorated = new _Decorated.default(registry, metadata);
      it('should throw if the storage function expects an argument', () => {
        expect(() => decorated.query.balances.account()).toThrowError(/requires one argument/);
      });
      it('should return a value if the storage function does not expect an argument', () => {
        expect(() => decorated.query.timestamp.now()).not.toThrow();
      });
      it('should return the correct length-prefixed storage key', () => {
        expect((0, _util.u8aToHex)(decorated.query.system.account(keyring.alice.address))).toEqual('0x410126aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9de1e86a9a8c739864cf3cc5ec2bea59fd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d');
      });
    });
  });