polkadot-js/api

View on GitHub
packages/types/src/interfaces/offchain/definitions.spec.ts

Summary

Maintainability
A
35 mins
Test Coverage
// Copyright 2017-2024 @polkadot/types authors & contributors
// SPDX-License-Identifier: Apache-2.0

/// <reference types="@polkadot/dev-test/globals.d.ts" />

import { TypeRegistry } from '../../create/index.js';

describe('offchain definitions', (): void => {
  const registry = new TypeRegistry();

  describe('StorageKind', (): void => {
    it('has the correct indexes', (): void => {
      expect(registry.createType('StorageKind').index).toEqual(1);
      expect(registry.createType('StorageKind', 'LOCAL').index).toEqual(2);
    });

    it('has a correct JSON for the type', (): void => {
      expect(registry.createType('StorageKind').toJSON()).toEqual('PERSISTENT');
    });
  });
});