forked from paketo-buildpacks/packit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
formatted_map_test.go
45 lines (39 loc) · 1.18 KB
/
formatted_map_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
package scribe_test
import (
"testing"
"github.com/paketo-buildpacks/packit"
"github.com/paketo-buildpacks/packit/scribe"
"github.com/sclevine/spec"
. "github.com/onsi/gomega"
)
func testFormattedMap(t *testing.T, context spec.G, it spec.S) {
var Expect = NewWithT(t).Expect
context("String", func() {
it("returns a formatted string representation of the map", func() {
Expect(scribe.FormattedMap{
"third": 3,
"first": 1,
"second": 2,
}.String()).To(Equal("first -> \"1\"\nsecond -> \"2\"\nthird -> \"3\""))
})
})
context("NewFormattedMapFromEnvironment", func() {
context("when the operation is override", func() {
it("prints the env in a well formatted map", func() {
Expect(scribe.NewFormattedMapFromEnvironment(packit.Environment{
"OVERRIDE.override": "some-value",
"DEFAULT.default": "some-value",
"PREPEND.prepend": "some-value",
"PREPEND.delim": ":",
"APPEND.append": "some-value",
"APPEND.delim": ":",
})).To(Equal(scribe.FormattedMap{
"OVERRIDE": "some-value",
"DEFAULT": "some-value",
"PREPEND": "some-value:$PREPEND",
"APPEND": "$APPEND:some-value",
}))
})
})
})
}