Lose of baby

How long after you lose a baby do you get a negative pregnancy test ??