text: "use strict";
  
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  
  var _bn = _interopRequireDefault(require("bn.js"));
  
  var _ = require(".");
  
  // Copyright 2017-2020 @polkadot/util authors & contributors
  // SPDX-License-Identifier: Apache-2.0
  describe('formatElapsed', () => {
    const start = 12345678;
    const now = new Date(12345678);
    it('formats a Date', () => {
      expect((0, _.formatElapsed)(now, new Date(start + 9700))).toEqual('9.7s');
    });
    it('formats a BN', () => {
      expect((0, _.formatElapsed)(now, new _bn.default(start + 42700))).toEqual('42s');
    });
    it('formats a Compact', () => {
      expect((0, _.formatElapsed)(now, {
        toBn: () => new _bn.default(start + 5.3 * 60000)
      })).toEqual('5m');
    });
    it('formats a number', () => {
      expect((0, _.formatElapsed)(now, start + 42 * 60 * 60000)).toEqual('42h');
    });
    it('formats defaults', () => {
      expect((0, _.formatElapsed)()).toEqual('0.0s');
    });
  });