{"size": 718, "ext": "js", "max_stars_repo_path": "test/fastDate.js", "max_stars_repo_name": "hudson-taylor/ht-schema", "max_stars_repo_stars_event_min_datetime": "2015-06-15T21:35:24.000Z", "max_stars_repo_stars_event_max_datetime": "2015-07-13T22:14:49.000Z", "max_issues_repo_path": "test/fastDate.js", "max_issues_repo_name": "hudson-taylor/ht-schema", "max_issues_repo_issues_event_min_datetime": "2015-04-05T11:57:23.000Z", "max_issues_repo_issues_event_max_datetime": "2018-08-13T07:29:24.000Z", "max_forks_repo_path": "test/fastDate.js", "max_forks_repo_name": "hudson-taylor/ht-schema", "max_forks_repo_forks_event_min_datetime": "2017-02-15T08:22:50.000Z", "max_forks_repo_forks_event_max_datetime": "2017-02-15T08:22:50.000Z"}
{"max_stars_count": 2, "max_issues_count": 8, "max_forks_count": 1, "avg_line_length": 20.5142857143, "max_line_length": 64, "alphanum_fraction": 0.5863509749}

"use strict";

const assert = require("assert");
const s      = require("../src");

describe("FastDate validator", function() {

  const old       = new Date("1979");
  const oldString = "1979";
  const older     = new Date("1970");

  it("should require value", function() {

    let schema = s.FastDate();

    assert.throws(function() {
      schema.validate();
    });

  });

  it("should accept a valid Date", function() {
    let schema = s.FastDate();
    assert.equal(schema.validate(old).getTime(), old.getTime());
  });

  it("should reject an invalid Date", function() {
    let schema = s.FastDate();
    assert.throws(function() {
      schema.validate({ dinosaur: "rawwwr" });
    }, Error);
  });

});