AnsweredAssumed Answered

Fixing logical error when testing with describe in Jasmine?

Question asked by aniemmanuelc on Oct 4, 2020
Latest reply on Oct 4, 2020 by aniemmanuelc

I get this error when running tests for an application. Here is the test:

dateUtil.ts

```

export const isDay = (date: Date) => {
const currentHour = date.getHours();
return currentHour > 6 && currentHour < 18;
};

```

dateUtil.spec.ts

```

import { isDay } from "./dateUtil";

describe("utils/dateUtil", () => {
describe("isDate", () => {
it("should determine if time of day is day or night", () => {
const day = "Tue Dec 18 2018 12:00:00 GMT-0800 (Pacific Standard Time)";
const night = "Tue Dec 18 2018 20:00:00 GMT-0800 (Pacific Standard Time)";

expect(isDay(new Date(day))).toBeTruthy();
expect(isDay(new Date(night))).toBeFalsy();
});
});
});

```

What am I getting wrong?

Outcomes