-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GO-4162 corrupted links in markdown import #1624
GO-4162 corrupted links in markdown import #1624
Conversation
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
Coverage provided by /~https://github.com/seriousben/go-patch-cover-action |
assert.Equal(t, model.BlockContentTextMark_Object, block.GetText().GetMarks().GetMarks()[1].Type) | ||
}) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
сonsider use @deff7's testutil.BuildStateFromAST
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see advantages in using it, because we need just to manipulate text block
@@ -89,3 +89,155 @@ func Test_processFiles(t *testing.T) { | |||
assert.Len(t, fileBlocks, 0) | |||
}) | |||
} | |||
|
|||
func Test_processTextBlock(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using real markdown test data here
testing small internal functions leads to fragile tests and don't cover the whole process of import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
fileNameToObjectId[snapshot.FileName] = snapshot.Id | ||
} | ||
var found bool | ||
expectedPath := "testdata" + string(filepath.Separator) + "links.md" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use filepath.Join
everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
https://linear.app/anytype/issue/GO-4162/corrupted-links-in-markdown-import
The problem is that we don't handle cases, when block have more than one markdown besides links. For example link can be also bold or italic.
To fix it