Praise be to Allah.
There is nothing wrong with having a test or swab for Covid-19 during the day in Ramadan, whether the swab is taken from the mouth or the nose, because insertion of the instrument in the throat or nose does not break the fast.
The fuqaha’ have defined what is meant by the throat and the inside of the mouth which, if anything reaches it, the fast is broken. This has been explained previously in the answer to question no. 312620.
If we assume that the instrument used to collect the swab reaches the throat, it still does not break the fast, because it is not food or drink, and does not come under the same heading as food or drink, and nothing of it reaches the stomach. So it cannot be regarded as breaking the fast, according to the view favoured by Shaykh al-Islam Ibn Taymiyah and a number of other scholars.
It says in a statement of the Islamic Fiqh Council regarding things that do not break the fast:
15.. Gastroscopy, so long as it is not accompanied by the introduction of fluids (solutions) or other substances.
End quote from Majallat al-Majma‘ (10/2/453-455).
The gastroscope goes beyond the throat and pharynx until it reaches the stomach, yet despite that it does not break the fast, so it is more appropriate to say that the fast will not be broken by the insertion of the instrument used to collect the swab even if it reaches the throat, let alone the nose.
For more information, please see the answer to questions no. 124205.
See also the answer to the question: Does receiving the Covid-19 vaccine during the day in Ramadan break the fast? (365511)
And Allah knows best.