mirror of
https://github.com/kjanat/articulate-parser.git
synced 2026-01-16 09:02:10 +01:00
refactor: Standardize method names and introduce context propagation
Removes the `Get` prefix from exporter methods (e.g., GetSupportedFormat -> SupportedFormat) to better align with Go conventions for simple accessors. Introduces `context.Context` propagation through the application, starting from `ProcessCourseFromURI` down to the HTTP request in the parser. This makes network operations cancellable and allows for setting deadlines, improving application robustness. Additionally, optimizes the HTML cleaner by pre-compiling regular expressions for a minor performance gain.
This commit is contained in:
@ -30,13 +30,13 @@ func TestNewDocxExporter(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestDocxExporter_GetSupportedFormat tests the GetSupportedFormat method.
|
||||
func TestDocxExporter_GetSupportedFormat(t *testing.T) {
|
||||
// TestDocxExporter_SupportedFormat tests the SupportedFormat method.
|
||||
func TestDocxExporter_SupportedFormat(t *testing.T) {
|
||||
htmlCleaner := services.NewHTMLCleaner()
|
||||
exporter := NewDocxExporter(htmlCleaner)
|
||||
|
||||
expected := "docx"
|
||||
result := exporter.GetSupportedFormat()
|
||||
result := exporter.SupportedFormat()
|
||||
|
||||
if result != expected {
|
||||
t.Errorf("Expected format '%s', got '%s'", expected, result)
|
||||
|
||||
Reference in New Issue
Block a user