import millisFromDuration from "./millisFromDuration";
import { Duration } from '../generated/google/protobuf/duration';

describe('millisFromDuration', () => {
  it('returns 0 if duration is not passed', () => {
    expect(millisFromDuration()).toEqual(0);
  });

  it('correctly returns the ms when the duration has both seconds and nanos', () => {
    const duration: Duration = { seconds: 34, nanos: 549_875_992 };
    expect(millisFromDuration(duration)).toEqual(34_549);
  });
});
