- Extract shared DeferClose helper, removing 14 duplicate copies - Rename PlayWright-prefixed types to cleaner names (BrowserOptions, BrowserSelection, NewBrowser, etc.) - Rename fields: ServerAddress, RequireServer (was DontLaunchOnConnectFailure) - Extract shared initBrowser/mergeOptions into browser_init.go, deduplicating ~120 lines between NewBrowser and NewInteractiveBrowser - Remove unused locator field from document struct - Add tests for all previously untested packages (archive, aislegopher, wegmans, useragents, powerball) and expand existing test suites - Add MIGRATION.md documenting all breaking API changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
638 B
Go
30 lines
638 B
Go
package extractor
|
|
|
|
import "testing"
|
|
|
|
func TestArticle_ZeroValue(t *testing.T) {
|
|
var a Article
|
|
if a.Title != "" || a.Content != "" || a.Length != 0 {
|
|
t.Error("zero-value Article should have empty fields")
|
|
}
|
|
}
|
|
|
|
func TestArticle_FieldAssignment(t *testing.T) {
|
|
a := Article{
|
|
Title: "Test Title",
|
|
Content: "<p>hello</p>",
|
|
TextContent: "hello",
|
|
Length: 5,
|
|
Excerpt: "hello",
|
|
Byline: "Author",
|
|
SiteName: "Example",
|
|
Lang: "en",
|
|
}
|
|
if a.Title != "Test Title" {
|
|
t.Errorf("Title = %q, want %q", a.Title, "Test Title")
|
|
}
|
|
if a.Length != 5 {
|
|
t.Errorf("Length = %d, want 5", a.Length)
|
|
}
|
|
}
|