(t *testing.T)
| 124 | } |
| 125 | |
| 126 | func TestGetAuthChainMultiple(t *testing.T) { |
| 127 | db := createEventDB() |
| 128 | |
| 129 | err := db.addFakeEvents(map[string][]string{ |
| 130 | "a": {}, |
| 131 | "b": {"a"}, |
| 132 | "c": {"a", "b"}, |
| 133 | "d": {"b", "c"}, |
| 134 | "e": {"a", "d"}, |
| 135 | "f": {"a", "b", "c"}, |
| 136 | }) |
| 137 | |
| 138 | if err != nil { |
| 139 | t.Fatalf("Failed to add events to db: %v", err) |
| 140 | } |
| 141 | |
| 142 | result, err := GetAuthChain(context.TODO(), db.EventsFromIDs, []string{"e", "f"}) |
| 143 | if err != nil { |
| 144 | t.Fatalf("getAuthChain failed: %v", err) |
| 145 | } |
| 146 | |
| 147 | var returnedIDs []string |
| 148 | for _, event := range result { |
| 149 | returnedIDs = append(returnedIDs, event.EventID()) |
| 150 | } |
| 151 | |
| 152 | expectedIDs := []string{"a", "b", "c", "d", "e", "f"} |
| 153 | |
| 154 | if !test.UnsortedStringSliceEqual(expectedIDs, returnedIDs) { |
| 155 | t.Fatalf("returnedIDs got '%v', expected '%v'", returnedIDs, expectedIDs) |
| 156 | } |
| 157 | } |
nothing calls this directly
no test coverage detected