Skip to content

Commit 0fc2d45

Browse files
author
Jimmy Byrd
committed
More project structure type asserts
1 parent 420b27e commit 0fc2d45

File tree

2 files changed

+59
-19
lines changed

2 files changed

+59
-19
lines changed

tests/MiniScaffold.Tests/Asserts.fs

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,51 @@ module Assert =
1313
| None -> failtest msg
1414

1515
let private tryFindFile file (d : DirectoryInfo) =
16-
d.GetFiles()
17-
|> Seq.tryFind(fun x -> x.Name = file)
18-
|> failIfNoneWithMsg (sprintf "Could not find %s in %s" file d.FullName)
16+
let filepath = Path.Combine(d.FullName, file)
17+
if filepath |> File.Exists |> not then
18+
failtestf "Could not find %s" filepath
1919

2020
let ``project can build target`` target (d : DirectoryInfo) =
2121
Builds.executeBuild d.FullName target
2222

23-
let ``.editorconfig exists`` (d : DirectoryInfo) =
24-
tryFindFile ".editorconfig" d
23+
let ``.config/dotnet-tools.json exists`` =
24+
tryFindFile ".config/dotnet-tools.json"
2525

26-
let ``.gitattributes exists`` (d : DirectoryInfo) =
27-
tryFindFile ".gitattributes" d
26+
let ``.github ISSUE_TEMPLATE bug_report exists`` =
27+
tryFindFile ".github/ISSUE_TEMPLATE/bug_report.md"
2828

29-
let ``paket.lock exists`` (d : DirectoryInfo) =
30-
tryFindFile "paket.lock" d
29+
let ``.github ISSUE_TEMPLATE feature_request exists`` =
30+
tryFindFile ".github/ISSUE_TEMPLATE/feature_request.md"
3131

32-
let ``paket.dependencies exists`` (d : DirectoryInfo) =
33-
tryFindFile "paket.dependencies" d
32+
let ``.github workflows build exists`` =
33+
tryFindFile ".github/workflows/build.yml"
34+
35+
let ``.github ISSUE_TEMPLATE exists`` =
36+
tryFindFile ".github/ISSUE_TEMPLATE.md"
37+
38+
let ``.github PULL_REQUEST_TEMPLATE exists`` =
39+
tryFindFile ".github/PULL_REQUEST_TEMPLATE.md"
40+
41+
let ``.editorconfig exists`` =
42+
tryFindFile ".editorconfig"
43+
44+
let ``.gitattributes exists`` =
45+
tryFindFile ".gitattributes"
46+
47+
let ``.gitignore exists`` =
48+
tryFindFile ".gitignore"
49+
50+
let ``LICENSE exists`` =
51+
tryFindFile "LICENSE.md"
52+
53+
let ``paket.lock exists`` =
54+
tryFindFile "paket.lock"
55+
56+
let ``paket.dependencies exists`` =
57+
tryFindFile "paket.dependencies"
58+
59+
let ``README exists`` =
60+
tryFindFile "README.md"
61+
62+
let ``RELEASE_NOTES exists`` =
63+
tryFindFile "RELEASE_NOTES.md"

tests/MiniScaffold.Tests/Tests.fs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,21 @@ module Tests =
3737

3838

3939

40-
let commonAsserts = [
40+
let projectStructureAsserts = [
41+
Assert.``.config/dotnet-tools.json exists``
42+
Assert.``.github ISSUE_TEMPLATE bug_report exists``
43+
Assert.``.github ISSUE_TEMPLATE feature_request exists``
44+
Assert.``.github workflows build exists``
45+
Assert.``.github ISSUE_TEMPLATE exists``
46+
Assert.``.github PULL_REQUEST_TEMPLATE exists``
4147
Assert.``.editorconfig exists``
4248
Assert.``.gitattributes exists``
49+
Assert.``.gitignore exists``
50+
Assert.``LICENSE exists``
4351
Assert.``paket.dependencies exists``
4452
Assert.``paket.lock exists``
53+
Assert.``README exists``
54+
Assert.``RELEASE_NOTES exists``
4555
]
4656

4757
[<Tests>]
@@ -51,18 +61,18 @@ module Tests =
5161
do setup ()
5262
yield! [
5363
"-n MyCoolLib --githubUsername CoolPersonNo2", [
54-
yield! commonAsserts
55-
Assert.``project can build target`` "DotnetPack"
56-
Assert.``project can build target`` "BuildDocs"
64+
yield! projectStructureAsserts
65+
// Assert.``project can build target`` "DotnetPack"
66+
// Assert.``project can build target`` "BuildDocs"
5767
]
5868
// test for dashes in name https://github.com/dotnet/templating/issues/1168#issuecomment-364592031
5969
"-n fsharp-data-sample --githubUsername CoolPersonNo2", [
60-
yield! commonAsserts
61-
Assert.``project can build target`` "DotnetPack"
70+
yield! projectStructureAsserts
71+
// Assert.``project can build target`` "DotnetPack"
6272
]
6373
"-n MyCoolApp --githubUsername CoolPersonNo2 --outputType Console", [
64-
yield! commonAsserts
65-
Assert.``project can build target`` "CreatePackages"
74+
yield! projectStructureAsserts
75+
// Assert.``project can build target`` "CreatePackages"
6676
]
6777

6878
] |> Seq.map(fun (args, additionalAsserts) -> testCase args <| fun _ ->

0 commit comments

Comments
 (0)