File size: 539 Bytes
7def60a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
package xsync_test

import (
	. "github.com/mudler/LocalAI/pkg/xsync"

	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/gomega"
)

var _ = Describe("SyncMap", func() {

	Context("Syncmap", func() {
		It("sets and gets", func() {
			m := NewSyncedMap[string, string]()
			m.Set("foo", "bar")
			Expect(m.Get("foo")).To(Equal("bar"))
		})
		It("deletes", func() {
			m := NewSyncedMap[string, string]()
			m.Set("foo", "bar")
			m.Delete("foo")
			Expect(m.Get("foo")).To(Equal(""))
			Expect(m.Exists("foo")).To(Equal(false))
		})
	})
})