(t *testing.T)
| 124 | } |
| 125 | |
| 126 | func TestVerifyScope(t *testing.T) { |
| 127 | apiHelper := createMockScopeHelper[TestFakeGithubRepo]("GithubId") |
| 128 | testCases := []struct { |
| 129 | name string |
| 130 | model TestModel |
| 131 | wantErr bool |
| 132 | }{ |
| 133 | { |
| 134 | name: "valid case", |
| 135 | model: TestModel{ |
| 136 | ID: 1, |
| 137 | Name: "test name", |
| 138 | }, |
| 139 | wantErr: false, |
| 140 | }, |
| 141 | { |
| 142 | name: "zero value", |
| 143 | model: TestModel{ |
| 144 | ID: 0, |
| 145 | Name: "test name", |
| 146 | }, |
| 147 | wantErr: true, |
| 148 | }, |
| 149 | { |
| 150 | name: "nil value", |
| 151 | model: TestModel{ |
| 152 | ID: 1, |
| 153 | Name: "", |
| 154 | }, |
| 155 | wantErr: false, |
| 156 | }, |
| 157 | } |
| 158 | |
| 159 | for _, tc := range testCases { |
| 160 | err := apiHelper.verifyScope(&tc.model, validator.New()) |
| 161 | if (err != nil) != tc.wantErr { |
| 162 | t.Errorf("unexpected error value - got: %v, want: %v", err, tc.wantErr) |
| 163 | } |
| 164 | |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | type TestScopeConfig struct { |
| 169 | common.Model `mapstructure:"-"` |
nothing calls this directly
no test coverage detected