-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from mealingr/npm_case_sensitive
Account for NPM being case-sensitive
- Loading branch information
Showing
2 changed files
with
19 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,10 @@ | |
*/ | ||
package com.github.packageurl; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.TreeMap; | ||
|
||
import org.apache.commons.io.IOUtils; | ||
import org.json.JSONArray; | ||
import org.json.JSONObject; | ||
|
@@ -30,10 +34,6 @@ | |
import org.junit.Test; | ||
import org.junit.rules.ExpectedException; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.TreeMap; | ||
|
||
/** | ||
* Test cases for PackageURL parsing | ||
* <p> | ||
|
@@ -303,4 +303,19 @@ public void testGetCoordinates() throws Exception { | |
PackageURL purl = new PackageURL("pkg:generic/acme/[email protected]?key1=value1&key2=value2"); | ||
Assert.assertEquals("pkg:generic/acme/[email protected]", purl.getCoordinates()); | ||
} | ||
|
||
@Test | ||
public void testNpmCaseSensitive() throws Exception { | ||
// e.g. https://www.npmjs.com/package/base64/v/1.0.0 | ||
PackageURL base64Lowercase = new PackageURL("pkg:npm/[email protected]"); | ||
Assert.assertEquals(base64Lowercase.getType(), "npm"); | ||
Assert.assertEquals(base64Lowercase.getName(), "base64"); | ||
Assert.assertEquals(base64Lowercase.getVersion(), "1.0.0"); | ||
|
||
// e.g. https://www.npmjs.com/package/Base64/v/1.0.0 | ||
PackageURL base64Uppercase = new PackageURL("pkg:npm/[email protected]"); | ||
Assert.assertEquals(base64Uppercase.getType(), "npm"); | ||
Assert.assertEquals(base64Uppercase.getName(), "Base64"); | ||
Assert.assertEquals(base64Uppercase.getVersion(), "1.0.0"); | ||
} | ||
} |