do NOT reverse and test! Only always use an approved voltage tester. The contactless testers can beep even with small voltage; best to use a multimeter. The hot to neutral must be ~120V, hot to ground also ~ 120V. The Neutral to ground may sometimes show phantom Voltages (~17 V, 29V etc).
Turn the breaker OFF then unscrew the nuts. Identify the wires from the breaker vs the wires that go to the receptacle on the fan housing. This is important because I have seen electricians using "whatever" color wire was available instead of following color code. After you identify, tag the hot wire from the breaker. It is likely the "line" is being fed from a junction box in the attic that also feeds another load.
Once you have identified and marked the wires then it is all super easy. Good luck
Turn the breaker OFF then unscrew the nuts. Identify the wires from the breaker vs the wires that go to the receptacle on the fan housing. This is important because I have seen electricians using "whatever" color wire was available instead of following color code. After you identify, tag the hot wire from the breaker. It is likely the "line" is being fed from a junction box in the attic that also feeds another load.
Once you have identified and marked the wires then it is all super easy. Good luck