It sounds like you bought a refurbished laptop. If you already upgraded the RAM, the fans are working, and the hardware/software/driver tests passed, the problem may be the CPU’s cooler.
An overheating CPU can cause a thermal trip error that makes the PC restart unexpectedly. If the person who refurbished the laptop didn't confirm that they placed the CPU cooler correctly (correct amount of paste, fully functional fan, etc.), I would ask Best Buy about that.