fix `if` rules, modify tests