jest.replaceProperty(object, propertyKey, value)
The property must already exisy on the object.
All properties could be restored to the original
value by calling jest.restoreAllMocks
on
afterEach
method.
test("isLocalhost return true when HOSTNAME is localhost", () => {
jest.replaceProperty(process, "env", { HOSTNAME:"localhost" });
expect(utils.isLocalhost()).toBe(true);
});