The tenancy survives the sale
A sale on its own does not end a residential tenancy. When the property transfers, the buyer becomes the landlord on the same terms, and the tenant keeps their lease, their rent, their deposit and every protection they had before. A fixed-term lease that has ended becomes month to month, and the buyer takes that on too. This is the starting point for every decision that follows. If your buyer is an investor, the tenant is part of what they are buying and the rent, the lease and the payment history become selling features. If your buyer wants to live in the home, the tenancy can only be ended through the specific process the Act provides, and only in the circumstances it allows. What you cannot do is write a clause into the agreement of purchase and sale that requires the tenant to leave; the tenant is not a party to that agreement and is not bound by it.