Skip to content

Commit

Permalink
Add test for getHxDepth
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrindel committed Nov 8, 2022
1 parent d29c184 commit 563f232
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions headerfinder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/stretchr/testify/assert"
"golang.org/x/net/html"
"golang.org/x/net/html/atom"
)

const singleH1 = `
Expand Down Expand Up @@ -98,3 +99,13 @@ func TestFindAttribute(t *testing.T) {
assert.False(t, ok)
})
}

func TestGetHxDepth(t *testing.T) {
assert.Equal(t, HxDepth(0), getHxDepth(atom.H1))
assert.Equal(t, HxDepth(1), getHxDepth(atom.H2))
assert.Equal(t, HxDepth(2), getHxDepth(atom.H3))
assert.Equal(t, HxDepth(3), getHxDepth(atom.H4))
assert.Equal(t, HxDepth(4), getHxDepth(atom.H5))
assert.Equal(t, HxDepth(5), getHxDepth(atom.H6))
assert.Equal(t, InvalidDepth, getHxDepth(atom.A))
}

0 comments on commit 563f232

Please sign in to comment.