"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

require("../../injector");

var _Header = _interopRequireDefault(require("../../json/Header.003.json"));

var _SignedBlock = _interopRequireDefault(require("../../json/SignedBlock.003.00.json"));

var _Digest = _interopRequireDefault(require("./Digest"));

// Copyright 2017-2019 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
describe('Digest', () => {
  it('decodes logs with consensus', () => {
    const digest = new _Digest.default(_Header.default.result.digest);
    expect(digest.logs.length).toEqual(1);
    const log = digest.logs[0];
    expect(log.type).toBe('Consensus');
    expect(log.value.toJSON()).toEqual([1634891105, '0x69c97e0f00000000479c09f7ace12ed3e1af2dba6cca6831e257e80feef56c7474d6c69bae6f4e8a6e0045a87afe14296992c38b7d55abcbe617c441cd35e8667abbcb1678f31802']);
  });
  it('filters logs, excluding items', () => {
    const logs = new _Digest.default(_SignedBlock.default.result.block.header.digest).logsWith('PreRuntime');
    expect(logs.length).toEqual(1);
    expect(logs[0].type).toEqual('PreRuntime');
  });
  it('filters logs, including items', () => {
    const logs = new _Digest.default(_SignedBlock.default.result.block.header.digest).logsWithout('PreRuntime');
    expect(logs.length).toEqual(1);
    expect(logs[0].type).toEqual('Seal');
  });
});