Date.now = jest.fn(() => new Date("2018-07-22T17:00:00.000Z").getTime()) jest.mock("jamplay-common/remote-config", () => { return { default() { return { publicRuntimeConfig: {}, remoteRuntimeConfig: {} } }, getConfig() { return { publicRuntimeConfig: {}, remoteRuntimeConfig: {} } } } }) console.log("init moment mock....") jest.mock("moment", () => { function momentMock(date) { return { fromNow: () => { return "ไม่กี่วันก่อนอะจ้า" } } } // tslint:disable-next-line:no-string-literal momentMock["locale"] = (d) => { console.log("set locale", d) } return momentMock })