let moment = require('moment');

let JobRun = require('../JobRun');
let JobTaskList = require('../JobTaskList');

describe('JobRun', function () {

  describe('#getDateCreated', function () {

    it('should return null if createdAt is undefined', function () {
      let activeRun = new JobRun({foo: 'bar'});
      expect(activeRun.getDateCreated()).toEqual(null);
    });

    it('should return the correct value in milliseconds', function () {
      let activeRun = new JobRun({createdAt: '1990-01-03T02:00:00Z-1'});
      expect(activeRun.getDateCreated()).toEqual(631332000000);
    });

  });

  describe('#getJobID', function () {

    it('should return the jobId', function () {
      let activeRun = new JobRun({jobId: 'foo'});
      expect(activeRun.getJobID()).toEqual('foo');
    });

  });

  describe('#getStatus', function () {

    it('should return the id', function () {
      let activeRun = new JobRun({status: 'foo'});
      expect(activeRun.getStatus()).toEqual('foo');
    });

  });

  describe('#getTasks', function () {

    it('should return an instance of JobTaskList', function () {
      let activeRun = new JobRun({id: 'foo', tasks: []});
      expect(activeRun.getTasks() instanceof JobTaskList).toBeTruthy();
    });

  });

});

let JobRun = require('../JobRun');
let JobTaskList = require('../JobTaskList');

describe('JobRun', function () {

  describe('#getDateCreated', function () {

    it('should return null if createdAt is undefined', function () {
      let activeRun = new JobRun({foo: 'bar'});
      expect(activeRun.getDateCreated()).toEqual(null);
    });

    it('should return the correct value in milliseconds', function () {
      let activeRun = new JobRun({createdAt: '1990-01-03T02:00:00Z-1'});
      expect(activeRun.getDateCreated()).toEqual(631332000000);
    });

  });

  describe('#getJobID', function () {

    it('should return the jobId', function () {
      let activeRun = new JobRun({jobId: 'foo'});
      expect(activeRun.getJobID()).toEqual('foo');
    });

  });

  describe('#getStatus', function () {

    it('should return the id', function () {
      let activeRun = new JobRun({status: 'foo'});
      expect(activeRun.getStatus()).toEqual('foo');
    });

  });

  describe('#getTasks', function () {

    it('should return an instance of JobTaskList', function () {
      let activeRun = new JobRun({id: 'foo', tasks: []});
      expect(activeRun.getTasks() instanceof JobTaskList).toBeTruthy();
    });

  });

});

Remove unused moment lib form job run test
Remove unused moment lib form job run test
