From 97ccbf251efa8422f1634f2fe0bb2cba090bcd56 Mon Sep 17 00:00:00 2001 From: realmarv Date: Thu, 6 Jul 2023 15:03:04 +0330 Subject: [PATCH] FileConventions: add another failing test Add failing test for DetectUnpinnedNpmPackageInstallVersions function. --- ...myCIWithUnpinnedNpmPackageInstallVersion3.yml | 11 +++++++++++ src/FileConventions.Test/FileConventions.Test.fs | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 src/FileConventions.Test/DummyFiles/DummyCIWithUnpinnedNpmPackageInstallVersion3.yml diff --git a/src/FileConventions.Test/DummyFiles/DummyCIWithUnpinnedNpmPackageInstallVersion3.yml b/src/FileConventions.Test/DummyFiles/DummyCIWithUnpinnedNpmPackageInstallVersion3.yml new file mode 100644 index 000000000..87ed0e981 --- /dev/null +++ b/src/FileConventions.Test/DummyFiles/DummyCIWithUnpinnedNpmPackageInstallVersion3.yml @@ -0,0 +1,11 @@ +name: CI + +on: [push, pull_request] + +jobs: + file-conventions: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install two npm packages, one with version and the other one without version + run: sudo npm install --save-dev @prettier/plugin-xml prettier@2.4.0 diff --git a/src/FileConventions.Test/FileConventions.Test.fs b/src/FileConventions.Test/FileConventions.Test.fs index 67ba593b9..fa0811b9a 100644 --- a/src/FileConventions.Test/FileConventions.Test.fs +++ b/src/FileConventions.Test/FileConventions.Test.fs @@ -202,6 +202,22 @@ let DetectUnpinnedNpmPackageInstallVersions3() = ) +[] +let DetectUnpinnedNpmPackageInstallVersions4() = + let fileInfo = + (FileInfo( + Path.Combine( + dummyFilesDirectory.FullName, + "DummyCIWithUnpinnedNpmPackageInstallVersion3.yml" + ) + )) + + Assert.That( + DetectUnpinnedNpmPackageInstallVersions fileInfo, + Is.EqualTo true + ) + + [] let DetectAsteriskInPackageReferenceItems1() = let fileInfo =