{"size": 2074, "ext": "js", "max_stars_repo_path": "src/__tests__/nav.test.js", "max_stars_repo_name": "benjaminboruff/apod-viewer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/__tests__/nav.test.js", "max_issues_repo_name": "benjaminboruff/apod-viewer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/__tests__/nav.test.js", "max_forks_repo_name": "benjaminboruff/apod-viewer", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 47.1363636364, "max_line_length": 88, "alphanum_fraction": 0.5920925747}
import moment from 'moment';
import { nextOkay, prevOkay } from '../js/nav';

describe("nextOkay()", () => {
    it("should return true when called with today's date", () => {
        expect(nextOkay(moment().format('YYYY-MM-DD'))).toBe(true);
    });
    it("should return true when called with yesterday's date", () => {
        expect(nextOkay(moment().subtract(1, 'd').format('YYYY-MM-DD'))).toBe(true);
    });
    it("should return true when called with date from 7 days ago", () => {
        expect(nextOkay(moment().subtract(7, 'd').format('YYYY-MM-DD'))).toBe(true);
    });
    it("should return false when called with tomorrow's date", () => {
        expect(nextOkay(moment().add(1, 'd').format('YYYY-MM-DD'))).toBe(false);
    });
    it("should return false when called with date 7 days from now", () => {
        expect(nextOkay(moment().add(7, 'd').format('YYYY-MM-DD'))).toBe(false);
    });
});

describe("prevOkay()", () => {
    it("should return true when called with today's date", () => {
        expect(prevOkay(moment().format('YYYY-MM-DD'))).toBe(true);
    });
    it("should return true when called with yesterday's date", () => {
        expect(prevOkay(moment().subtract(1, 'd').format('YYYY-MM-DD'))).toBe(true);
    });
    it("should return true when called with date from 7 days ago", () => {
        expect(prevOkay(moment().subtract(7, 'd').format('YYYY-MM-DD'))).toBe(true);
    });
    it("should return false when called with tomorrow's date", () => {
        expect(prevOkay(moment().add(1, 'd').format('YYYY-MM-DD'))).toBe(false);
    });
    it("should return false when called with date 7 days from now", () => {
        expect(prevOkay(moment().add(7, 'd').format('YYYY-MM-DD'))).toBe(false);
    });
    it("should return true when called with the APOD start date", () => {
        expect(prevOkay(moment('1996-06-16', 'YYYY-MM-DD'))).toBe(true);
    });
    it("should return false when called with the day after the APOD start date", () => {
        expect(prevOkay(moment('1996-06-15', 'YYYY-MM-DD'))).toBe(false);
    });
});