Skip to content

Commit 11d2f49

Browse files
committed
#244 - this closes #244, examples for system and API tests do not exist
1 parent c2b97a5 commit 11d2f49

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

docs/test-strategy/testing-strategy.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,35 @@ These are marked as integration tests since neither of them execute on a singula
108108
Every method should have a unit test, as it's a straight forward project to run TDD on. However as with most prototypes this is probably not the case, and thus it is necessary to determine which parts of the system are still exploratory.
109109
Writing a lot of unit tests for existing methods, which are still being restructured is a waste of productivity.
110110

111-
Good examples of unit tests would be this method in []()
111+
Good examples of unit tests would be this method in [plugin_test.go](https://github.com/Praqma/git-phlow/blob/master/plugins/plugin_test.go)
112+
113+
```
114+
Describe("Branch name from issue", func() {
115+
testsToRun := [7]testCase{
116+
{issue: 12, branchName: "work on iss", expected: "12-work-on-iss", casedesc: "Test replaces whitespaces with dash '-'"},
117+
{issue: 45, branchName: "Case SENsitivity", expected: "45-case-sensitivity", casedesc: "Test converts charecters to lowercase"},
118+
{issue: 15, branchName: ".branch name", expected: "15-branch-name", casedesc: "Test removes . prefix"},
119+
{issue: 220, branchName: "^^..:~:name", expected: "220-name", casedesc: "removes ASCII control characters"},
120+
{issue: 2735, branchName: "name/", expected: "2735-name", casedesc: "test removes end / "},
121+
{issue: 234567, branchName: ".NAME.is\"dotted", expected: "234567-name-is-dotted", casedesc: "test removes backslash"},
122+
{issue: 672, branchName: "add big data blog /", expected: "672-add-big-data-blog", casedesc: "remove forward slash"},
123+
}
124+
125+
Context("Names should follow format rules", func() {
126+
127+
for _, currentTest := range testsToRun {
128+
129+
It(currentTest.casedesc, func() {
130+
actualName := BranchNameFromIssue(strconv.Itoa(currentTest.issue), currentTest.branchName)
131+
132+
Ω(actualName).Should(Equal(currentTest.expected))
133+
})
134+
}
135+
})
136+
})
137+
```
138+
139+
This is a unit test, as no calls are made other than the single method in question (which compares the name to format rules)
112140

113141

114142
## Handling "legacy" code

0 commit comments

Comments
 (0)