UNPKG

694 BJavaScriptView Raw
1// Copyright 2017-2018 @polkadot/api-provider authors & contributors
2// This software may be modified and distributed under the terms
3// of the ISC license. See the LICENSE file for details.
4
5import createState from './state';
6
7describe('state', () => {
8 let state;
9
10 beforeEach(() => {
11 state = createState();
12 });
13
14 it('generates a sane initial state', () => {
15 expect(
16 state
17 ).toMatchObject({
18 subscriptionId: 0,
19 subscriptionMap: {}
20 });
21 });
22
23 it('generates a proper section_method map', () => {
24 expect(
25 state.subscriptions
26 ).toMatchObject({
27 'chain_newHead': {
28 callbacks: {},
29 lastValue: null
30 }
31 });
32 });
33});