You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
974 B

package main
import (
func Test_parseMicroformats(t *testing.T) {
app := &goBlog{
cfg: createDefaultTestConfig(t),
err := app.initConfig(false)
require.NoError(t, err)
testHtmlBytes, err := os.ReadFile("testdata/wmtest.html")
require.NoError(t, err)
testHtml := string(testHtmlBytes)
mockClient := newFakeHttpClient()
mockClient.setFakeResponse(http.StatusOK, testHtml)
app.httpClient = mockClient.Client
m, err := app.parseMicroformats("", false)
require.NoError(t, err)
assert.Equal(t, "Micropub, Crossposting to Twitter, and Enabling “Tweetsto…", m.Title)
assert.NotEmpty(t, m.Content)
assert.Equal(t, "Test Blogger", m.Author)
assert.Equal(t, "", m.Url)