Engine control module turns on the fan.
Either because your temperature is high or AC is switch on.
Its not unheard of having a faulty new relay. They are very difficult to test because its a electronic controled relay and its output is pluse width modulation
The wider the pluse the faster the fan spins. Its a 12v pluse but a DC meter won't read it.
Ossiliscope could measure the output but very few of us have one so an ac meter might give you an indication of 6 to 8 ac volts.
The most common problem is the relay and repeated relay failure is worn fan.
Connecting the fan to battery doesnt tell you if the fan is worn or drawing too much current blowing relay. It only a crude check fan will spin with power.
I haven't tried it but believe if the tempture sensor is disconnected the fan should spin full speed. Although as yours isnt working with AC either I suspect you have faulty new relay or damaged wiring connection going to fan.
WJ 2001 3.1TD