This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1501 from OpenBazaar/modpanic
Fix NotifyModerators panic if node is not yet bootstrapped
- Loading branch information
Showing
9 changed files
with
79 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package api | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func Test_extractModeratorChanges(t *testing.T) { | ||
currentModList := []string{"a", "b", "c"} | ||
newModList := []string{"a", "x", "c"} | ||
|
||
toAdd, toDelete := extractModeratorChanges(newModList, ¤tModList) | ||
if len(toAdd) != 1 { | ||
t.Errorf("Returned incorrect number of additions: expected %d got %d", 1, len(toAdd)) | ||
} | ||
if len(toDelete) != 1 { | ||
t.Errorf("Returned incorrect number of deletions: expected %d got %d", 1, len(toDelete)) | ||
} | ||
|
||
if toAdd[0] != "x" { | ||
t.Errorf("Returned incorrect addition: expected a got %s", toAdd[0]) | ||
} | ||
if toDelete[0] != "b" { | ||
t.Errorf("Returned incorrect deletion: expected b got %s", toDelete[0]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters