Take the carpet out and pitch it. Clean all of any wood that has been wet with a bleach solution or Lysol Original Cleaner. Install your preference of flooring after it drys.
A mold test doesn't fit the situation, here. FWIW, a mold spore may take 8 hrs. to fall from ceiling to floor. In that time, you can remediate the mold. There may also be some off-gassing from rotten wood or deteriorating glue. It may be that a fast drying paint/sealer would help with that. Shellac dries in minutes.
Good luck on the repair. Oh btw, you may wish to get a deodorizing sponge/brick after your work is done. It's amazing how even a small odor can throw off someone sensitive to mold/chemicals.