How accept in interview that give one week to do a test?

I just start applying, some of the companies ask you to write a sample test base on some framework. In my opinion, the code I sent is perfect and also check by other CTOs and also they admit it, but I still get rejected. I can not understand why? is there anything that I might miss or any other reason?