|
6 | 6 | "reflect" |
7 | 7 | "regexp" |
8 | 8 | "sort" |
9 | | - "strconv" |
10 | 9 |
|
11 | 10 | "testing" |
12 | 11 |
|
@@ -221,49 +220,6 @@ func TestZipSourceWithAngularSample(t *testing.T) { |
221 | 220 | log.Info("---------- Finished Test: TestZipSourceWithAngularSample ----------\n\n") |
222 | 221 | } |
223 | 222 |
|
224 | | -// Unit test for `UsesLockfileVersion3()` with a lock file that uses version 3 (`./sample-projects/lockfile-v3-test/package-lock.json`) |
225 | | -func TestUsesLockfileVersion3(t *testing.T) { |
226 | | - expected := true |
227 | | - pathToLockFile := "." + string(os.PathSeparator) + "sample-projects" + string(os.PathSeparator) + "lockfile-v3-test" + |
228 | | - string(os.PathSeparator) + "package-lock.json" |
229 | | - usesLockFileV3 := UsesLockfileVersion3(pathToLockFile) |
230 | | - |
231 | | - if !usesLockFileV3 { |
232 | | - t.Error("Test failed!") |
233 | | - t.Errorf("Got: %v", strconv.FormatBool(usesLockFileV3)) |
234 | | - t.Errorf("Expected: %v", strconv.FormatBool(expected)) |
235 | | - } |
236 | | -} |
237 | | - |
238 | | -// Unit test for `UsesLockfileVersion3()` with a lock file that does not use version 3 (`./sample-projects/sample-node-project/package-lock.json`) |
239 | | -func TestDoesNotUseLockfileVersion3(t *testing.T) { |
240 | | - expected := false |
241 | | - pathToLockFile := "." + string(os.PathSeparator) + "sample-projects" + string(os.PathSeparator) + "sample-node-project" + |
242 | | - string(os.PathSeparator) + "package-lock.json" |
243 | | - usesLockFileV3 := UsesLockfileVersion3(pathToLockFile) |
244 | | - |
245 | | - if usesLockFileV3 { |
246 | | - t.Error("Test failed!") |
247 | | - t.Errorf("Got: %v", strconv.FormatBool(usesLockFileV3)) |
248 | | - t.Errorf("Expected: %v", strconv.FormatBool(expected)) |
249 | | - } |
250 | | -} |
251 | | - |
252 | | -// Integration test for the logic to identify lockfile version 3 with `./sample-projects/lockfile-v3-test` |
253 | | -func TestLockfileV3Integrationtest(t *testing.T) { |
254 | | - sourcePath := "." + string(os.PathSeparator) + "sample-projects" + string(os.PathSeparator) + "lockfile-v3-test" |
255 | | - |
256 | | - // generate the zip file and return a list of all its file names |
257 | | - checkForPotentialSmells(sourcePath) |
258 | | - |
259 | | - // check if the global `usesLockfileVersion3` is true |
260 | | - if !usesLockfileVersion3 { |
261 | | - t.Error("Test failed! It uses lockfile version 3 but this is not identified") |
262 | | - t.Errorf("Got: %v", strconv.FormatBool(usesLockfileVersion3)) |
263 | | - t.Errorf("Expected: %v", strconv.FormatBool(true)) |
264 | | - } |
265 | | -} |
266 | | - |
267 | 223 | func generateZipAndReturnItsFiles(sourcePath string, targetPath string, testsPath string) []string { |
268 | 224 | // generate the zip file, and omit all non-required files |
269 | 225 | if err := zipSource(sourcePath, targetPath, testsPath); err != nil { |
|
0 commit comments