How to write test to get current time and convert time using React Testing Library

Viewed 80

I have two methods I want to use through out my React App. These methods are supposed to get the current time and convert the time based on timezone.

import momentTimezone from "moment-timezone";

function getCurrentTimeInEST() {
    return momentTimezone().tz("America/New_York");
}

function convertUTCTimeToEST(timeInUTC: Date){
    return momentTimezone.utc(timeInUTC).tz("America/New_York");
}

export {
    getCurrentTimeInEST,
    convertUTCTimeToEST
};

What should my test look like to get coverage for these two methods?

0 Answers
Related