Skip to content

Commit

Permalink
fix two tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Oct 14, 2024
1 parent 022d4ce commit f9271a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
6 changes: 3 additions & 3 deletions nip11/nip11_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ func TestFetch(t *testing.T) {
expectedName string
expectedURL string
}{
{"wss://relay.nostr.bg", false, "", "wss://relay.nostr.bg"},
{"https://relay.nostr.bg", false, "", "wss://relay.nostr.bg"},
{"relay.nostr.bg", false, "", "wss://relay.nostr.bg"},
{"wss://nostr.wine", false, "", "wss://nostr.wine"},
{"https://nostr.wine", false, "", "wss://nostr.wine"},
{"nostr.wine", false, "", "wss://nostr.wine"},
{"wlenwqkeqwe.asjdaskd", true, "", "wss://wlenwqkeqwe.asjdaskd"},
}

Expand Down
24 changes: 2 additions & 22 deletions nip13/nip13_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,27 +128,6 @@ func TestDoWorkTimeout(t *testing.T) {
}
}

func BenchmarkGenerate(b *testing.B) {
if testing.Short() {
b.Skip("too consuming for short mode")
}
for _, difficulty := range []int{8, 16, 24} {
difficulty := difficulty
b.Run(fmt.Sprintf("%dbits", difficulty), func(b *testing.B) {
for i := 0; i < b.N; i++ {
event := &nostr.Event{
Kind: nostr.KindTextNote,
Content: "It's just me mining my own business",
PubKey: "a48380f4cfcc1ad5378294fcac36439770f9c878dd880ffa94bb74ea54a6f243",
}
if _, err := Generate(event, difficulty, time.Minute); err != nil {
b.Fatal(err)
}
}
})
}
}

func BenchmarkDoWork(b *testing.B) {
if testing.Short() {
b.Skip("too consuming for short mode")
Expand All @@ -162,7 +141,8 @@ func BenchmarkDoWork(b *testing.B) {
Content: "It's just me mining my own business",
PubKey: "a48380f4cfcc1ad5378294fcac36439770f9c878dd880ffa94bb74ea54a6f243",
}
ctx, _ := context.WithTimeout(context.Background(), time.Second*60)
ctx, cancel := context.WithTimeout(context.Background(), time.Second*60)
defer cancel()
if _, err := DoWork(ctx, *event, difficulty); err != nil {
b.Fatal(err)
}
Expand Down

0 comments on commit f9271a6

Please sign in to comment.