Make first WebUI random page stick

This commit is contained in:
Deluan
2024-05-19 12:35:30 -04:00
parent 653b4d97f9
commit 3977ef6e0f
6 changed files with 75 additions and 21 deletions
+14
View File
@@ -40,4 +40,18 @@ var _ = Describe("HashFunc", func() {
Expect(sum).To(Equal(hashFunc("1", input)))
Expect(sum2).To(Equal(hashFunc("2", input)))
})
It("keeps the same hash for the same id and seed", func() {
id := "1"
hashFunc := hasher.HashFunc()
hasher.SetSeed(id, "original_seed")
sum := hashFunc(id, input)
Expect(sum).To(Equal(hashFunc(id, input)))
hasher.Reseed(id)
Expect(sum).NotTo(Equal(hashFunc(id, input)))
hasher.SetSeed(id, "original_seed")
Expect(sum).To(Equal(hashFunc(id, input)))
})
})