Files
common/packages/code-primitives-builder/src/header.spec.js
T
Jaco Greeff 78e01a0e16 Combine util, types & trie into common (#150)
* Pull in trie repo

* Bring in types repo
2018-06-26 21:26:51 +02:00

42 lines
1.1 KiB
JavaScript

// Copyright 2017-2018 @polkadot/primitives-builder authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import txRoot from './extrinsic/rootRaw';
import extrinsics from '@polkadot/extrinsics';
import encodeUnchecked from '@polkadot/extrinsics-codec/encode/unchecked';
import testingPairs from '@polkadot/util-keyring/testingPairs';
import header from './header';
const keyring = testingPairs();
describe('header', () => {
it('applies the all transactions (no timestamp)', () => {
expect(
header({}).extrinsicsRoot
).toEqual(
txRoot([])
);
});
it('applies the all transactions (extrinsicsRoot)', () => {
const transactions = [
encodeUnchecked(keyring.nobody, 0)(
extrinsics.timestamp.public.set,
[54321]
),
encodeUnchecked(keyring.one, 0)(
extrinsics.timestamp.public.set,
[12345]
)
];
expect(
header({}, transactions).extrinsicsRoot
).toEqual(
txRoot(transactions)
);
});
});