Commit 203fb3f
authored
refactor(component,generic,http): move test functions to test files and improve code legibility (#1131)
Because
- PR #1121 comments requested moving test-specific functions out of
production code to improve code organization
- Nested if-else structures in test code reduced readability and could
be simplified with early returns
This commit
- Moves `NewTestURLValidator` from `validator.go` to `validator_test.go`
to keep test utilities in test files
- Moves `InitForTest` from `main.go` to `validator_test.go` to separate
test-specific component initialization from production code
- Refactors nested if-else structure in validator test (lines 90-99)
using early returns to improve code legibility
- Removes test functions from production code, reducing binary size and
improving maintainability1 parent 4571d6a commit 203fb3f
File tree
3 files changed
+34
-31
lines changed- pkg/component/generic/http/v0
3 files changed
+34
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | 86 | | |
102 | 87 | | |
103 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | 31 | | |
41 | 32 | | |
42 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
11 | 35 | | |
12 | 36 | | |
13 | 37 | | |
| |||
89 | 113 | | |
90 | 114 | | |
91 | 115 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 116 | + | |
99 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
100 | 127 | | |
101 | 128 | | |
102 | 129 | | |
| |||
0 commit comments