(t *testing.T)
| 92 | } |
| 93 | |
| 94 | func TestGetAuthChainSingle(t *testing.T) { |
| 95 | db := createEventDB() |
| 96 | |
| 97 | err := db.addFakeEvents(map[string][]string{ |
| 98 | "a": {}, |
| 99 | "b": {"a"}, |
| 100 | "c": {"a", "b"}, |
| 101 | "d": {"b", "c"}, |
| 102 | "e": {"a", "d"}, |
| 103 | }) |
| 104 | |
| 105 | if err != nil { |
| 106 | t.Fatalf("Failed to add events to db: %v", err) |
| 107 | } |
| 108 | |
| 109 | result, err := GetAuthChain(context.TODO(), db.EventsFromIDs, []string{"e"}) |
| 110 | if err != nil { |
| 111 | t.Fatalf("getAuthChain failed: %v", err) |
| 112 | } |
| 113 | |
| 114 | var returnedIDs []string |
| 115 | for _, event := range result { |
| 116 | returnedIDs = append(returnedIDs, event.EventID()) |
| 117 | } |
| 118 | |
| 119 | expectedIDs := []string{"a", "b", "c", "d", "e"} |
| 120 | |
| 121 | if !test.UnsortedStringSliceEqual(expectedIDs, returnedIDs) { |
| 122 | t.Fatalf("returnedIDs got '%v', expected '%v'", returnedIDs, expectedIDs) |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | func TestGetAuthChainMultiple(t *testing.T) { |
| 127 | db := createEventDB() |
nothing calls this directly
no test coverage detected