Goodness-of-fit tests under permutations