package douyin import "testing" func TestParseShareTargetHTML(t *testing.T) { body := []byte(``) profile, ok := ParseShareTargetHTML(body, "7667952980074745151") if !ok { t.Fatal("expected share author to parse") } if profile.SecUID != "MS4wLjABAAAAexample" || profile.UniqueID != "muzi_code" || profile.Nickname != "木子不写代码" || profile.AvatarURL != "https://example.com/avatar.jpg" { t.Fatalf("unexpected share profile: %+v", profile) } } func TestParseShareTargetHTMLRejectsWrongWork(t *testing.T) { body := []byte(``) if _, ok := ParseShareTargetHTML(body, "2"); ok { t.Fatal("accepted a mismatched work id") } }