In most situations as long as the actual test complies with the regulations of your destination country, and you do not leave the transit zone enroute, your test will be compliant. It is also important to make sure the time validity of your test is not compromised by any increased journey time, for example some countries require the test to have been conducted within a 72 hours’ time frame.
If you do leave the transit area and stop off in the country before resuming your journey you will be governed by regulations between that country and the country of your final destination which may be different.
Regulations and restrictions are changing rapidly so please check your airline website or destination government website for the latest up to date requirements.
It is the sole responsibility of passengers to clarify in good time, with their airline, the testing requirements needed for their destination as the situation is under constant change. Information can also be found at https://www.gov.uk/foreign-travel-advice