diff --git a/tests/MiniScaffold.Tests/Asserts.fs b/tests/MiniScaffold.Tests/Asserts.fs index f9516418..ea21a10f 100644 --- a/tests/MiniScaffold.Tests/Asserts.fs +++ b/tests/MiniScaffold.Tests/Asserts.fs @@ -13,21 +13,51 @@ module Assert = | None -> failtest msg let private tryFindFile file (d : DirectoryInfo) = - d.GetFiles() - |> Seq.tryFind(fun x -> x.Name = file) - |> failIfNoneWithMsg (sprintf "Could not find %s in %s" file d.FullName) + let filepath = Path.Combine(d.FullName, file) + if filepath |> File.Exists |> not then + failtestf "Could not find %s" filepath let ``project can build target`` target (d : DirectoryInfo) = Builds.executeBuild d.FullName target - let ``.editorconfig exists`` (d : DirectoryInfo) = - tryFindFile ".editorconfig" d + let ``.config/dotnet-tools.json exists`` = + tryFindFile ".config/dotnet-tools.json" - let ``.gitattributes exists`` (d : DirectoryInfo) = - tryFindFile ".gitattributes" d + let ``.github ISSUE_TEMPLATE bug_report exists`` = + tryFindFile ".github/ISSUE_TEMPLATE/bug_report.md" - let ``paket.lock exists`` (d : DirectoryInfo) = - tryFindFile "paket.lock" d + let ``.github ISSUE_TEMPLATE feature_request exists`` = + tryFindFile ".github/ISSUE_TEMPLATE/feature_request.md" - let ``paket.dependencies exists`` (d : DirectoryInfo) = - tryFindFile "paket.dependencies" d + let ``.github workflows build exists`` = + tryFindFile ".github/workflows/build.yml" + + let ``.github ISSUE_TEMPLATE exists`` = + tryFindFile ".github/ISSUE_TEMPLATE.md" + + let ``.github PULL_REQUEST_TEMPLATE exists`` = + tryFindFile ".github/PULL_REQUEST_TEMPLATE.md" + + let ``.editorconfig exists`` = + tryFindFile ".editorconfig" + + let ``.gitattributes exists`` = + tryFindFile ".gitattributes" + + let ``.gitignore exists`` = + tryFindFile ".gitignore" + + let ``LICENSE exists`` = + tryFindFile "LICENSE.md" + + let ``paket.lock exists`` = + tryFindFile "paket.lock" + + let ``paket.dependencies exists`` = + tryFindFile "paket.dependencies" + + let ``README exists`` = + tryFindFile "README.md" + + let ``RELEASE_NOTES exists`` = + tryFindFile "RELEASE_NOTES.md" diff --git a/tests/MiniScaffold.Tests/Tests.fs b/tests/MiniScaffold.Tests/Tests.fs index cca0f9ec..dc47fe46 100755 --- a/tests/MiniScaffold.Tests/Tests.fs +++ b/tests/MiniScaffold.Tests/Tests.fs @@ -37,11 +37,21 @@ module Tests = - let commonAsserts = [ + let projectStructureAsserts = [ + Assert.``.config/dotnet-tools.json exists`` + Assert.``.github ISSUE_TEMPLATE bug_report exists`` + Assert.``.github ISSUE_TEMPLATE feature_request exists`` + Assert.``.github workflows build exists`` + Assert.``.github ISSUE_TEMPLATE exists`` + Assert.``.github PULL_REQUEST_TEMPLATE exists`` Assert.``.editorconfig exists`` Assert.``.gitattributes exists`` + Assert.``.gitignore exists`` + Assert.``LICENSE exists`` Assert.``paket.dependencies exists`` Assert.``paket.lock exists`` + Assert.``README exists`` + Assert.``RELEASE_NOTES exists`` ] [] @@ -51,17 +61,17 @@ module Tests = do setup () yield! [ "-n MyCoolLib --githubUsername CoolPersonNo2", [ - yield! commonAsserts + yield! projectStructureAsserts Assert.``project can build target`` "DotnetPack" Assert.``project can build target`` "BuildDocs" ] // test for dashes in name https://github.com/dotnet/templating/issues/1168#issuecomment-364592031 "-n fsharp-data-sample --githubUsername CoolPersonNo2", [ - yield! commonAsserts + yield! projectStructureAsserts Assert.``project can build target`` "DotnetPack" ] "-n MyCoolApp --githubUsername CoolPersonNo2 --outputType Console", [ - yield! commonAsserts + yield! projectStructureAsserts Assert.``project can build target`` "CreatePackages" ]