Skip to content

Commit

Permalink
FileConventions.Test: add failing test
Browse files Browse the repository at this point in the history
Add failing test for
DetectNotUsingKebabCaseInGitHubCIJobs
function.
  • Loading branch information
tehraninasab committed Mar 29, 2023
1 parent a63a87d commit 89dff6d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: CI

on: [push, pull_request]

jobs:
FileConventions:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Print "Hello World!"
run: echo "Hello World!"
13 changes: 13 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,16 @@ let DetectNotUsingSnakeCaseInScriptName3() =
(FileInfo(Path.Combine(dummyFilesDirectory.FullName, "kebab-case.fsx")))

Assert.That(DetectNotUsingSnakeCaseInScriptName fileInfo, Is.EqualTo true)


[<Test>]
let DetectNotUsingKebabCaseInGitHubCIJobs1() =
let fileInfo =
(FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyCIWithPascalCaseJobName.yml"
)
))

Assert.That(DetectNotUsingKebabCaseInGitHubCIJobs fileInfo, Is.EqualTo true)
4 changes: 4 additions & 0 deletions src/FileConventions/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,7 @@ let DetectNotUsingSnakeCaseInScriptName(fileInfo: FileInfo) =
let fileName = fileInfo.Name
let snakeCase = fileName.ToLower() = fileName && not(fileName.Contains "-")
not(snakeCase)

let DetectNotUsingKebabCaseInGitHubCIJobs(fileInfo: FileInfo) =
assert (fileInfo.FullName.EndsWith ".yml")
false

0 comments on commit 89dff6d

Please sign in to comment.