Files
plugin-drone-npm/plugin_test.go
T
Stephen McMillen 416f0a47fa Allow for Hosts to have paths with tokens
This changes the config from only passing the host through to allowing for the inclusion of a path with it.
2019-10-28 16:56:09 -04:00

25 lines
614 B
Go

package main
import (
"testing"
)
func TestTokenRCContents(t *testing.T) {
conf := Config{
Registry: "https://npm.someorg.com/",
Token: "token",
}
actual := npmrcContentsToken(conf)
expected := "//npm.someorg.com/:_authToken=token"
if actual != expected {
t.Errorf("Unexpected token config (Got: %s, Expected: %s)", actual, expected)
}
conf.Registry = "https://npm.someorg.com/with/path/"
actual = npmrcContentsToken(conf)
expected = "//npm.someorg.com/with/path/:_authToken=token"
if actual != expected {
t.Errorf("Unexpected token config (Got: %s, Expected: %s)", actual, expected)
}
}