test($files) move some duplicated file test code to helper