mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-10 02:40:11 +08:00
config: add reprovider options test.
This is a left over from previous PR as I forgot to check it in.
This commit is contained in:
parent
1ca5c9dd84
commit
321269fd29
28
config/reprovider_test.go
Normal file
28
config/reprovider_test.go
Normal file
@ -0,0 +1,28 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseReproviderStrategy(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
expect ReproviderStrategy
|
||||
}{
|
||||
{"all", ReproviderStrategyAll},
|
||||
{"flat", ReproviderStrategyFlat},
|
||||
{"pinned", ReproviderStrategyPinned},
|
||||
{"mfs", ReproviderStrategyMFS},
|
||||
{"flat+pinned", ReproviderStrategyFlat | ReproviderStrategyPinned},
|
||||
{"pinned+mfs", ReproviderStrategyPinned | ReproviderStrategyMFS},
|
||||
{"invalid", 0},
|
||||
{"all+invalid", ReproviderStrategyAll},
|
||||
{"", ReproviderStrategyAll},
|
||||
{"flat+all", ReproviderStrategyAll},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
result := ParseReproviderStrategy(tt.input)
|
||||
if result != tt.expect {
|
||||
t.Errorf("ParseReproviderStrategy(%q) = %d, want %d", tt.input, result, tt.expect)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user