diff --git a/StagingArea/test/test@5.0.0-use+suffixes.fsx b/StagingArea/test/test@5.0.0-use+suffixes.fsx index 5d4f8f0..3ee54e1 100644 --- a/StagingArea/test/test@5.0.0-use+suffixes.fsx +++ b/StagingArea/test/test@5.0.0-use+suffixes.fsx @@ -1,11 +1,11 @@ -let []PACKAGE_METADATA = """(* +(* --- Name: test MajorVersion: 5 MinorVersion: 0 PatchVersion: 0 -PreRelease: use -BuildMetadata: suffixes +PreReleaseVersionSuffix: use +BuildMetadataVersionSuffix: suffixes Publish: true Summary: this package is here for testing purposes only. Description: this package is here for testing purposes only. @@ -22,26 +22,9 @@ Tags: - Name: validation - Name: my-package - Name: thing -ReleaseNotes: Use ARCExpect v3 +ReleaseNotes: Use pre-release and build metadata version suffixes CQCHookEndpoint: https://avpr.nfdi4plants.org --- -*)""" +*) -printfn "If you can read this in your console, you successfully executed test package v5.0.0-use+suffixes!" - -#r "nuget: ARCExpect, 3.0.0" - -open ARCExpect -open Expecto -let test_package = - Setup.ValidationPackage( - metadata = Setup.Metadata(PACKAGE_METADATA), - CriticalValidationCases = [ - test "yes" {Expect.equal 1 1 "yes"} - ] - ) - -test_package -|> Execute.ValidationPipeline( - basePath = System.Environment.CurrentDirectory -) \ No newline at end of file +printfn "If you can read this in your console, you successfully executed test package v5.0.0-use+suffixes!" \ No newline at end of file diff --git a/StagingAreaTests/FileContentTests.fs b/StagingAreaTests/FileContentTests.fs index 8ac0570..07ea340 100644 --- a/StagingAreaTests/FileContentTests.fs +++ b/StagingAreaTests/FileContentTests.fs @@ -5,18 +5,24 @@ open System.IO open Xunit open Utils +open AVPRIndex + module FileContent = [] let ``All files have frontmatter`` () = Assert.All( - ReferenceObjects.all_staged_packages_contents, - snd >> Assert.ContainsFrontmatter + ReferenceObjects.all_staged_packages_paths, + File.ReadAllText >> (fun x -> x.ReplaceLineEndings("\n")) >> Assert.ContainsFrontmatter ) [] let ``All files have valid metadata`` () = Assert.All( - ReferenceObjects.all_staged_packages_metadata, - snd >> Assert.MetadataValid + ReferenceObjects.all_staged_packages_paths, + (fun p -> + p + |> ValidationPackageMetadata.extractFromScript + |> Assert.MetadataValid + ) ) \ No newline at end of file diff --git a/StagingAreaTests/PackageSanityChecks.fs b/StagingAreaTests/PackageSanityChecks.fs index 633cad3..2ec417b 100644 --- a/StagingAreaTests/PackageSanityChecks.fs +++ b/StagingAreaTests/PackageSanityChecks.fs @@ -5,16 +5,17 @@ open System.IO open Xunit open Utils +open AVPRIndex module Metadata = [] let ``Metadata versions match file names`` () = Assert.All( - ReferenceObjects.all_staged_packages_metadata, - (fun (path, metadata) -> + ReferenceObjects.all_staged_packages_paths, + (fun path -> let file_name_version = (Path.GetFileNameWithoutExtension path).Split('@')[1] - let metadata_version = sprintf "%i.%i.%i" metadata.MajorVersion metadata.MinorVersion metadata.PatchVersion + let metadata_version = path |> ValidationPackageMetadata.extractFromScript |> ValidationPackageMetadata.getSemanticVersionString Assert.Equal(file_name_version, metadata_version) ) ) diff --git a/StagingAreaTests/ReferenceObjects.fs b/StagingAreaTests/ReferenceObjects.fs index 9844e5e..8bc4eaf 100644 --- a/StagingAreaTests/ReferenceObjects.fs +++ b/StagingAreaTests/ReferenceObjects.fs @@ -15,18 +15,4 @@ let all_files_in_staging_area = let all_staged_packages_paths = Directory.GetFiles(staging_area_root, "*.fsx", SearchOption.AllDirectories) - |> Array.map (fun x -> x.Replace('\\',Path.DirectorySeparatorChar).Replace('/',Path.DirectorySeparatorChar)) - -let all_staged_packages_contents = - all_staged_packages_paths - |> Array.map (fun p -> - p, - p |> (File.ReadAllText >> fun x -> x.ReplaceLineEndings("\n")) - ) - -let all_staged_packages_metadata = - all_staged_packages_paths - |> Array.map (fun p -> - p, - ValidationPackageMetadata.extractFromScript p - ) \ No newline at end of file + |> Array.map (fun x -> x.Replace('\\',Path.DirectorySeparatorChar).Replace('/',Path.DirectorySeparatorChar)) \ No newline at end of file diff --git a/StagingAreaTests/Utils.fs b/StagingAreaTests/Utils.fs index eda7511..1ac3d29 100644 --- a/StagingAreaTests/Utils.fs +++ b/StagingAreaTests/Utils.fs @@ -41,5 +41,5 @@ type Assert with static member FileNameValid(path:string) = let fileName = Path.GetFileName(path) let folderName = Path.GetDirectoryName(path) |> Path.GetFileName - let pattern = sprintf @"^%s@\d+\.\d+\.\d+\.fsx$" folderName + let pattern = sprintf @"^%s@%s.fsx$" folderName AVPRIndex.Globals.SEMVER_REGEX_PATTERN[1.. (AVPRIndex.Globals.SEMVER_REGEX_PATTERN.Length - 2)] // first and last characters of that regex are start/end signifiers Assert.Matches(pattern, fileName) \ No newline at end of file diff --git a/tests/ClientTests/ReferenceObjects.fs b/tests/ClientTests/ReferenceObjects.fs index 9c2ea2e..3b2598a 100644 --- a/tests/ClientTests/ReferenceObjects.fs +++ b/tests/ClientTests/ReferenceObjects.fs @@ -103,7 +103,7 @@ module Hash = Hash = expected_hash_cqcHookAddition ) - let expected_hash_semVerAddition = "2A546201341641AAB21FB49DADD06676" + let expected_hash_semVerAddition = "E3D3C259C4B3F54783283735B20F8C23" let allFields_semVerAddition = AVPRClient.PackageContentHash( PackageName = "name", @@ -154,8 +154,8 @@ Description = description MajorVersion: 1 MinorVersion: 0 PatchVersion: 0 -PreRelease: use -BuildMetadata: suffixes +PreReleaseVersionSuffix: use +BuildMetadataVersionSuffix: suffixes Publish: true Authors: - FullName: test diff --git a/tests/ClientTests/fixtures/allFields_semVerAddition.fsx b/tests/ClientTests/fixtures/allFields_semVerAddition.fsx index f2c73ca..29a0fe8 100644 --- a/tests/ClientTests/fixtures/allFields_semVerAddition.fsx +++ b/tests/ClientTests/fixtures/allFields_semVerAddition.fsx @@ -6,8 +6,8 @@ Description = description MajorVersion: 1 MinorVersion: 0 PatchVersion: 0 -PreRelease: use -BuildMetadata: suffixes +PreReleaseVersionSuffix: use +BuildMetadataVersionSuffix: suffixes Publish: true Authors: - FullName: test