use crate::common::{input_under_test, zizmor};

#[test]
fn test_adhoc_packages() -> anyhow::Result<()> {
    insta::assert_snapshot!(
        zizmor()
            .input(input_under_test("adhoc-packages.yml"))
            .run()?,
        @r#"
    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:18:14
       |
    18 |         run: gem install rake
       |         ---  ^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:22:14
       |
    22 |         run: gem install rake rspec
       |         ---  ^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:26:14
       |
    26 |         run: gem install rake:13.0.6
       |         ---  ^^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:30:14
       |
    30 |         run: gem install rake -v 13.0.6
       |         ---  ^^^^^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:34:14
       |
    34 |         run: gem install --no-document rake
       |         ---  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:38:14
       |
    38 |         run: gem i rake
       |         ---  ^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:44:11
       |
    42 |         run: |
       |         --- this step
    43 |           echo "Hello"
    44 |           gem install foo
       |           ^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:45:11
       |
    42 |         run: |
       |         --- this step
    ...
    45 |           gem install bar
       |           ^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:50:14
       |
    50 |         run: npm install lodash
       |         ---  ^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:54:14
       |
    54 |         run: npm install oxlint@1.55.0
       |         ---  ^^^^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:56:14
       |
    56 |         run: npm install oxlint@^1.55.0
       |         ---  ^^^^^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:60:14
       |
    60 |         run: npm install --no-fund oxlint@1.55.0
       |         ---  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:64:14
       |
    64 |         run: npm i lodash
       |         ---  ^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
      --> @@INPUT@@:68:14
       |
    68 |         run: npm add lodash
       |         ---  ^^^^^^^^^^^^^^ installs a package outside of a lockfile
       |         |
       |         this step
       |
       = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
       --> @@INPUT@@:110:14
        |
    110 |         run: gem install rake
        |         ---  ^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
        |         |
        |         this step
        |
        = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
       --> @@INPUT@@:114:14
        |
    114 |         run: npm install lodash
        |         ---  ^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
        |         |
        |         this step
        |
        = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
       --> @@INPUT@@:118:14
        |
    118 |         run: npm i lodash
        |         ---  ^^^^^^^^^^^^ installs a package outside of a lockfile
        |         |
        |         this step
        |
        = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
       --> @@INPUT@@:122:14
        |
    122 |         run: npm install lodash@1.2.3
        |         ---  ^^^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
        |         |
        |         this step
        |
        = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
       --> @@INPUT@@:124:14
        |
    124 |         run: npm install lodash@^1.2.3
        |         ---  ^^^^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
        |         |
        |         this step
        |
        = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
       --> @@INPUT@@:130:11
        |
    128 |         run: |
        |         --- this step
    129 |           Write-Host "Hello"
    130 |           gem install foo
        |           ^^^^^^^^^^^^^^^ installs a package outside of a lockfile
        |
        = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
       --> @@INPUT@@:135:14
        |
    135 |         run: gem install foo bar baz
        |         ---  ^^^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
        |         |
        |         this step
        |
        = note: audit confidence → High

    help[adhoc-packages]: ad-hoc installation of packages
       --> @@INPUT@@:139:14
        |
    139 |         run: gem install foo@1.2.3
        |         ---  ^^^^^^^^^^^^^^^^^^^^^ installs a package outside of a lockfile
        |         |
        |         this step
        |
        = note: audit confidence → High

    22 findings: 0 informational, 22 low, 0 medium, 0 high
    "#
    );

    Ok(())
}
