Skip to content

Commit

Permalink
Add tests for enforce_file ruletype
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslav Dimitrov <[email protected]>
  • Loading branch information
rdimitrov committed Dec 18, 2024
1 parent f562175 commit aa474b3
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions rule-types/common/enforce_file.test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
tests:
- name: "File should be present"
def:
file: README
params: {}
expect: "pass"
git:
repo_base: file_present
- name: "File is missing"
def:
file: README
params: {}
expect: "fail"
git:
repo_base: file_missing
- name: "File present and matches content"
def:
file: README
content: "Test content"
params: {}
expect: "pass"
git:
repo_base: file_present
- name: "File present, but has different content"
def:
file: README
content: "Different content"
params: {}
expect: "fail"
git:
repo_base: file_present
- name: "File present, but has more content than expected"
def:
file: README
content: "Test"
params: { }
expect: "fail"
git:
repo_base: file_present
- name: "File present, but has less content than expected"
def:
file: README
content: "Test content with a subset"
params: { }
expect: "fail"
git:
repo_base: file_present
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test content

0 comments on commit aa474b3

Please sign in to comment.