rule: AM05

# Default config
test_fail_lone_join_default:
  fail_str: "SELECT foo.a, bar.b FROM foo JOIN bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo INNER JOIN bar;\n"

test_fail_lone_join_lowercase_default:
  fail_str: "SELECT foo.a, bar.b FROM foo join bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo inner join bar;\n"

test_pass_inner_join_default:
  pass_str: "SELECT foo.a, bar.b FROM foo INNER JOIN bar;\n"

test_pass_left_join_default:
  pass_str: "SELECT foo.a, bar.b FROM foo LEFT JOIN bar;\n"

test_pass_right_join_default:
  pass_str: "SELECT foo.a, bar.b FROM foo RIGHT JOIN bar;\n"

test_pass_full_join_default:
  pass_str: "SELECT foo.a, bar.b FROM foo FULL JOIN bar;\n"

test_pass_left_outer_join_default:
  pass_str: "SELECT foo.a, bar.b FROM foo LEFT OUTER JOIN bar;\n"

test_pass_right_outer_join_default:
  pass_str: "SELECT foo.a, bar.b FROM foo RIGHT OUTER JOIN bar;\n"

test_pass_full_outer_join_default:
  pass_str: "SELECT foo.a, bar.b FROM foo FULL OUTER JOIN bar;\n"

test_pass_cross_join_default:
  pass_str: "SELECT foo.a, bar.b FROM foo CROSS JOIN bar;\n"

# Config = "inner"
test_fail_lone_join_inner:
  fail_str: "SELECT foo.a, bar.b FROM foo JOIN bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo INNER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: inner

test_fail_lone_join_lowercase_inner:
  fail_str: "SELECT foo.a, bar.b FROM foo join bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo inner join bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: inner

test_pass_inner_join_inner:
  pass_str: "SELECT foo.a, bar.b FROM foo INNER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: inner

test_pass_left_join_inner:
  pass_str: "SELECT foo.a, bar.b FROM foo LEFT JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: inner

test_pass_right_join_inner:
  pass_str: "SELECT foo.a, bar.b FROM foo RIGHT JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: inner

test_pass_full_join_inner:
  pass_str: "SELECT foo.a, bar.b FROM foo FULL JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: inner

test_pass_left_outer_join_inner:
  pass_str: "SELECT foo.a, bar.b FROM foo LEFT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: inner


test_pass_right_outer_join_inner:
  pass_str: "SELECT foo.a, bar.b FROM foo RIGHT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: inner

test_pass_full_outer_join_inner:
  pass_str: "SELECT foo.a, bar.b FROM foo FULL OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: inner

# Config = "outer"
test_pass_lone_join_outer:
  pass_str: "SELECT foo.a, bar.b FROM foo JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: outer

test_pass_inner_join_outer:
  pass_str: "SELECT foo.a, bar.b FROM foo INNER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: outer

test_fail_left_join_outer:
  fail_str: "SELECT foo.a, bar.b FROM foo LEFT JOIN bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo LEFT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: outer

test_fail_right_join_outer:
  fail_str: "SELECT foo.a, bar.b FROM foo RIGHT JOIN bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo RIGHT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: outer

test_fail_full_join_outer:
  fail_str: "SELECT foo.a, bar.b FROM foo FULL JOIN bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo FULL OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: outer

test_fail_full_join_lowercase_outer:
  fail_str: "SELECT foo.a, bar.b FROM foo full join bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo full outer join bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: outer

test_pass_left_outer_join_outer:
  pass_str: "SELECT foo.a, bar.b FROM foo LEFT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: outer


test_pass_right_outer_join_outer:
  pass_str: "SELECT foo.a, bar.b FROM foo RIGHT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: outer

test_pass_full_outer_join_outer:
  pass_str: "SELECT foo.a, bar.b FROM foo FULL OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: outer

# Config = "both"
test_fail_lone_join_both:
  fail_str: "SELECT foo.a, bar.b FROM foo JOIN bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo INNER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both

test_fail_lone_join_lowercase_both:
  fail_str: "SELECT foo.a, bar.b FROM foo join bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo inner join bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both

test_pass_inner_join_both:
  pass_str: "SELECT foo.a, bar.b FROM foo INNER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both

test_fail_left_join_both:
  fail_str: "SELECT foo.a, bar.b FROM foo LEFT JOIN bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo LEFT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both

test_fail_right_join_both:
  fail_str: "SELECT foo.a, bar.b FROM foo RIGHT JOIN bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo RIGHT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both

test_fail_full_join_both:
  fail_str: "SELECT foo.a, bar.b FROM foo FULL JOIN bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo FULL OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both

test_fail_full_join_lowercase_both:
  fail_str: "SELECT foo.a, bar.b FROM foo full join bar;\n"
  fix_str: "SELECT foo.a, bar.b FROM foo full outer join bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both

test_pass_left_outer_join_both:
  pass_str: "SELECT foo.a, bar.b FROM foo LEFT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both


test_pass_right_outer_join_both:
  pass_str: "SELECT foo.a, bar.b FROM foo RIGHT OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both

test_pass_full_outer_join_both:
  pass_str: "SELECT foo.a, bar.b FROM foo FULL OUTER JOIN bar;\n"
  configs:
    rules:
      ambiguous.join:
        fully_qualify_join_types: both