fix: some bug
This commit is contained in:
@@ -26,9 +26,6 @@ func DetectType(markdownContent string) (string, error) {
|
||||
|
||||
blocks := matcher.MatchBlocksFuzzy(markdownContent, defaultSchema, 0.3)
|
||||
|
||||
fmt.Printf("%+v\n", blocks[0])
|
||||
fmt.Printf("Content: '%q'\n", blocks[0].GetContent())
|
||||
|
||||
result, err := decoders.Parse(blocks)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to parse blocks -> %w", err)
|
||||
@@ -84,6 +81,12 @@ func ParseFile(markdownContent string) (any, error) {
|
||||
startMarkdown := time.Now()
|
||||
blocks := matcher.MatchBlocksFuzzy(markdownContent, tpl, 0.3)
|
||||
|
||||
fmt.Println("Blocks: ", len(blocks))
|
||||
for i, b := range blocks {
|
||||
fmt.Printf("Block %d %+v\n", i, b)
|
||||
fmt.Printf("Content %d: %q\n\n", i, b.GetContent())
|
||||
}
|
||||
|
||||
result, err := decoders.Parse(blocks)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse blocks -> %w", err)
|
||||
|
@@ -18,12 +18,14 @@ func TestParseRecipe_Golden(t *testing.T) {
|
||||
t.Fatalf("ParseFile: %v", err)
|
||||
}
|
||||
|
||||
gotMap := got.(map[string]any)
|
||||
|
||||
var want map[string]any
|
||||
if err := json.Unmarshal(output, &want); err != nil {
|
||||
t.Fatalf("unmarshal expected.json: %v", err)
|
||||
}
|
||||
|
||||
if diff := cmp.Diff(want, got); diff != "" {
|
||||
if diff := cmp.Diff(want, gotMap["data"]); diff != "" {
|
||||
t.Fatalf("JSON mismatch (-want +got):\n%s", diff)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user