Conditions | 4 |
Total Lines | 16 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | package page_test |
||
12 | func TestHero(t *testing.T) { |
||
13 | r, w := io.Pipe() |
||
14 | const name = "John" |
||
15 | go func() { |
||
16 | _ = page.Hero(name).Render(context.Background(), w) |
||
17 | _ = w.Close() |
||
18 | }() |
||
19 | |||
20 | doc, err := goquery.NewDocumentFromReader(r) |
||
21 | if err != nil { |
||
22 | t.Fatalf("Error reading document: %s", err) |
||
23 | } |
||
24 | |||
25 | // Assert that the hero exists |
||
26 | if doc.Find(`[data-testid="hero"]`).Length() != 1 { |
||
27 | t.Errorf("Expected to find a hero") |
||
28 | } |
||
30 |