Unless you hook them up to a lie detector test than so called tests like that will never work because people can just as easily lie to fully immerse themselves in the culture to get what they want. That also violates their civil liberties to believe in whatever they want. It probably won't stop terrorism either.
We do not test people for their extreme beliefs, whether they are rooted in Christianity, Islam, or something else. America was founded on the idea of freedom from religious persecution and testing Muslims for belief in Shira law is religious persecution, no matter the misguided reason for this kind of testing.
No, the United States should not be able to test all Muslims in the country for any reason, including their beliefs. Not only would that be targeting a specific population of people, but it is founded in a stereotype. It is offensive and naive to believe that all members of a group are potentially terrorists.
The United States should not be testing Muslim Americans to see if they believe in Sharia Law. This type of test would be discrimination against Muslims, because other groups of Americans would not be tested. In addition to such a test not being constitutional, it would further alienate Muslims, and make the country less safe.