Skip to content

Commit bb4671c

Browse files
committed
set NewDigester back
Signed-off-by: zhaque44 <[email protected]>
1 parent 374e4ba commit bb4671c

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

internal/index/digest_test.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,26 @@ func TestWithIndex(t *testing.T) {
5959
}
6060

6161
func TestNewDigester(t *testing.T) {
62-
g := NewWithT(t)
63-
6462
t.Run("default", func(t *testing.T) {
63+
g := NewWithT(t)
64+
6565
d := NewDigester()
66+
6667
g.Expect(d).ToNot(BeNil())
67-
g.Expect(d.index).To(BeEmpty())
68+
g.Expect(d.index).ToNot(BeNil())
6869
g.Expect(d.digests).ToNot(BeNil())
6970
})
7071

7172
t.Run("with index", func(t *testing.T) {
72-
initialIndex := map[string]string{"foo": "bar"}
73-
d := NewDigester(WithIndex(initialIndex))
73+
g := NewWithT(t)
74+
75+
i := map[string]string{"foo": "bar"}
76+
d := NewDigester(WithIndex(i))
77+
7478
g.Expect(d).ToNot(BeNil())
75-
g.Expect(d.index).To(Equal(initialIndex))
79+
g.Expect(d.index).To(Equal(i))
7680
g.Expect(d.digests).ToNot(BeNil())
7781
})
78-
79-
t.Run("handles multiple WithIndex options, applying last one", func(t *testing.T) {
80-
firstIndex := map[string]string{"a": "b"}
81-
secondIndex := map[string]string{"c": "d"}
82-
d := NewDigester(WithIndex(firstIndex), WithIndex(secondIndex))
83-
g.Expect(d.index).To(Equal(secondIndex))
84-
})
8582
}
8683

8784
func TestDigester_Add(t *testing.T) {

0 commit comments

Comments
 (0)