If you try to use command/command blocks to test if a player is holding an enchanted item, if the item was enchanted using any survival method, it cannot find the player. It will only work if the item was obtained though the "give" command with the enchantment directly on the item.
Please provide exact commands used here.