@@ -40,6 +40,9 @@ class PubCacheReaderTest : WordSpec({
4040 val gitPackageCacheDir = tmpPubCacheDir.resolve("git/$PACKAGE_NAME -$RESOLVED_REF ")
4141 val gitPackageWithPathCacheDir = tmpPubCacheDir.resolve("git/$PACKAGE_NAME -$RESOLVED_REF /$PACKAGE_NAME ")
4242 val hostedPackageCacheDir = tmpPubCacheDir.resolve("hosted/oss-review-toolkit.org/$PACKAGE_NAME -$PACKAGE_VERSION ")
43+ val customPackageCacheDir = tmpPubCacheDir.resolve(
44+ "hosted/oss-review-toolkit.org%47api%47pub%47repository%47/$PACKAGE_NAME -$PACKAGE_VERSION "
45+ )
4346 val localPackagePathAbsolute = ABSOLUTE_PATH
4447 val localPackagePathRelative = ABSOLUTE_PATH .resolve(RELATIVE_PATH )
4548
@@ -49,6 +52,7 @@ class PubCacheReaderTest : WordSpec({
4952 gitPackageCacheDir.safeMkdirs()
5053 gitPackageWithPathCacheDir.safeMkdirs()
5154 hostedPackageCacheDir.safeMkdirs()
55+ customPackageCacheDir.safeMkdirs()
5256 }
5357
5458 " findProjectRoot()" should {
@@ -81,6 +85,21 @@ class PubCacheReaderTest : WordSpec({
8185 reader.findProjectRoot(packageInfo, ABSOLUTE_PATH ) shouldBe gitPackageWithPathCacheDir
8286 }
8387
88+ " resolve the path of a Git dependency with special path" {
89+ val packageInfo = PackageInfo (
90+ dependency = "direct main",
91+ description = PackageInfo .Description (
92+ path = ".",
93+ resolvedRef = RESOLVED_REF ,
94+ url = "https://github.com/oss-review-toolkit/$PACKAGE_NAME .git"
95+ ),
96+ source = "git",
97+ version = "9.9.9"
98+ )
99+
100+ reader.findProjectRoot(packageInfo, ABSOLUTE_PATH ) shouldBe gitPackageCacheDir
101+ }
102+
84103 " resolve the path of a hosted dependency" {
85104 val packageInfo = PackageInfo (
86105 dependency = "transitive",
@@ -95,6 +114,20 @@ class PubCacheReaderTest : WordSpec({
95114 reader.findProjectRoot(packageInfo, ABSOLUTE_PATH ) shouldBe hostedPackageCacheDir
96115 }
97116
117+ " resolve the path of a custom package repository dependency" {
118+ val packageInfo = PackageInfo (
119+ dependency = "transitive",
120+ description = PackageInfo .Description (
121+ name = PACKAGE_NAME ,
122+ url = "https://oss-review-toolkit.org/api/pub/repository/"
123+ ),
124+ source = "hosted",
125+ version = PACKAGE_VERSION
126+ )
127+
128+ reader.findProjectRoot(packageInfo, ABSOLUTE_PATH ) shouldBe customPackageCacheDir
129+ }
130+
98131 " resolve the relative path of a local dependency" {
99132 val packageInfo = PackageInfo (
100133 dependency = "transitive",
0 commit comments