Skip to content

Commit

Permalink
test(node): Add another test case for parseNpmVcsInfo()
Browse files Browse the repository at this point in the history
The repository nodes can be textual, see [1]. Add a test to clarify
the parsing works for that.

[1]: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository

Signed-off-by: Frank Viernau <[email protected]>
  • Loading branch information
fviernau committed Apr 12, 2024
1 parent b4d70ad commit dde0365
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class NpmSupportTest : WordSpec({
}

"parseNpmVcsInfo()" should {
"get VCS information from an object node" {
"get VCS information from an object node containing a repository node which is an object" {
val node = """
{
"gitHead": "bar",
Expand All @@ -211,6 +211,21 @@ class NpmSupportTest : WordSpec({
"foo"
)
}

"get VCS information from an object node containing a repository node which is textual" {
val node = """
{
"gitHead": "bar",
"repository": "git+ssh://example.com/a/b.git"
}
""".readJsonTree()

parseNpmVcsInfo(node) shouldBe VcsInfo(
VcsType.UNKNOWN,
"git+ssh://example.com/a/b.git",
"bar"
)
}
}

"splitNpmNamespaceAndName()" should {
Expand Down

0 comments on commit dde0365

Please sign in to comment.