Skip to content

Commit

Permalink
Add yaml integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper-Ben committed Sep 11, 2022
1 parent b957a82 commit 4505a0f
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
tmp/
todocheck
testing/authtokens.yaml
9 changes: 9 additions & 0 deletions testing/scenarios/scripts/file.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is a yaml file

# A malformed TODO comment

# TODO 123: This is a valid todo comment

# TODO 321: This is an invalid todo, marked against a closed issue

foo: bar # TODO 567: This is an invalid todo, marked against a non-existent issue
9 changes: 9 additions & 0 deletions testing/scenarios/scripts/file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is a yaml file

# A malformed TODO comment

# TODO 123: This is a valid todo comment

# TODO 321: This is an invalid todo, marked against a closed issue

foo: bar # TODO 567: This is an invalid todo, marked against a non-existent issue
30 changes: 30 additions & 0 deletions testing/todocheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,36 @@ func TestScriptsTodos(t *testing.T) {
WithType(errors.TODOErrTypeNonExistentIssue).
WithLocation("scenarios/scripts/script.bash", 9).
ExpectLine("curl \"localhost:8080\" # TODO 567: This is an invalid todo, marked against a non-existent issue")).
ExpectTodoErr(
scenariobuilder.NewTodoErr().
WithType(errors.TODOErrTypeMalformed).
WithLocation("scenarios/scripts/file.yaml", 3).
ExpectLine("# A malformed TODO comment")).
ExpectTodoErr(
scenariobuilder.NewTodoErr().
WithType(errors.TODOErrTypeIssueClosed).
WithLocation("scenarios/scripts/file.yaml", 7).
ExpectLine("# TODO 321: This is an invalid todo, marked against a closed issue")).
ExpectTodoErr(
scenariobuilder.NewTodoErr().
WithType(errors.TODOErrTypeNonExistentIssue).
WithLocation("scenarios/scripts/file.yaml", 9).
ExpectLine("foo: bar # TODO 567: This is an invalid todo, marked against a non-existent issue")).
ExpectTodoErr(
scenariobuilder.NewTodoErr().
WithType(errors.TODOErrTypeMalformed).
WithLocation("scenarios/scripts/file.yml", 3).
ExpectLine("# A malformed TODO comment")).
ExpectTodoErr(
scenariobuilder.NewTodoErr().
WithType(errors.TODOErrTypeIssueClosed).
WithLocation("scenarios/scripts/file.yml", 7).
ExpectLine("# TODO 321: This is an invalid todo, marked against a closed issue")).
ExpectTodoErr(
scenariobuilder.NewTodoErr().
WithType(errors.TODOErrTypeNonExistentIssue).
WithLocation("scenarios/scripts/file.yml", 9).
ExpectLine("foo: bar # TODO 567: This is an invalid todo, marked against a non-existent issue")).
Run()
if err != nil {
t.Errorf("%s", err)
Expand Down

0 comments on commit 4505a0f

Please sign in to comment.