-
Notifications
You must be signed in to change notification settings - Fork 8
/
environment_test.go
48 lines (38 loc) · 1.16 KB
/
environment_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package noderunscript_test
import (
"testing"
noderunscript "github.com/paketo-buildpacks/node-run-script"
"github.com/sclevine/spec"
. "github.com/onsi/gomega"
)
func testEnvironment(t *testing.T, context spec.G, it spec.S) {
var Expect = NewWithT(t).Expect
it("returns a parsed environment", func() {
environment := noderunscript.LoadEnvironment([]string{
"BP_NODE_RUN_SCRIPTS=some-node-run-scripts-value",
"LOG_LEVEL=some-log-level-value",
})
Expect(environment).To(Equal(noderunscript.Environment{
LogLevel: "some-log-level-value",
NodeRunScripts: "some-node-run-scripts-value",
}))
})
context("when no values are set", func() {
it("uses the defaults", func() {
environment := noderunscript.LoadEnvironment([]string{})
Expect(environment).To(Equal(noderunscript.Environment{
LogLevel: "INFO",
NodeRunScripts: "build",
}))
})
})
context("when explicit empty values are given", func() {
it("uses the empty values", func() {
environment := noderunscript.LoadEnvironment([]string{
"BP_NODE_RUN_SCRIPTS=",
"LOG_LEVEL=",
})
Expect(environment).To(Equal(noderunscript.Environment{}))
})
})
}