mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 16:56:47 +00:00
Further I created some unit test which should cover all relevant scenarios for the created function. Signed-off-by: Simon Pelczer <templum.dev@gmail.com>
32 lines
720 B
Go
32 lines
720 B
Go
package plugin
|
|
|
|
import "testing"
|
|
|
|
const fallbackValue = 120
|
|
|
|
func TestLabelValueWasEmpty(t *testing.T) {
|
|
extractedValue := extractLabelValue("", fallbackValue)
|
|
|
|
if extractedValue != fallbackValue {
|
|
t.Log("Expected extractedValue to equal the fallbackValue")
|
|
t.Fail()
|
|
}
|
|
}
|
|
|
|
func TestLabelValueWasValid(t *testing.T) {
|
|
extractedValue := extractLabelValue("42", fallbackValue)
|
|
|
|
if extractedValue != 42 {
|
|
t.Log("Expected extractedValue to equal answer to life (42)")
|
|
t.Fail()
|
|
}
|
|
}
|
|
|
|
func TestLabelValueWasInValid(t *testing.T) {
|
|
extractedValue := extractLabelValue("InvalidValue", fallbackValue)
|
|
|
|
if extractedValue != fallbackValue {
|
|
t.Log("Expected extractedValue to equal the fallbackValue")
|
|
t.Fail()
|
|
}
|
|
} |