MCPcopy Create free account
hub / github.com/PasarGuard/node / TestBuildUsersFromChunksOrdersByIndex

Function TestBuildUsersFromChunksOrdersByIndex

controller/users_chunk_test.go:10–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestBuildUsersFromChunksOrdersByIndex(t *testing.T) {
11 chunks := map[uint64][]*common.User{
12 1: {
13 {Email: "second"},
14 },
15 0: {
16 {Email: "first"},
17 },
18 }
19
20 users, err := BuildUsersFromChunks(chunks, 1, true)
21 if err != nil {
22 t.Fatalf("expected users to build successfully, got error: %v", err)
23 }
24
25 if len(users) != 2 || users[0].GetEmail() != "first" || users[1].GetEmail() != "second" {
26 t.Fatalf("users not ordered by index: %#v", users)
27 }
28}
29
30func TestBuildUsersFromChunksMissingLast(t *testing.T) {
31 _, err := BuildUsersFromChunks(map[uint64][]*common.User{}, 0, false)

Callers

nothing calls this directly

Calls 2

BuildUsersFromChunksFunction · 0.85
GetEmailMethod · 0.65

Tested by

no test coverage detected