mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-08 05:47:07 +09:00
GO-2078: add test
Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
This commit is contained in:
parent
7310fbf053
commit
dbf9c3b212
1 changed files with 35 additions and 0 deletions
35
util/svg/rasterizer_no_test.go
Normal file
35
util/svg/rasterizer_no_test.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
//go:build !rasterizesvg
|
||||
|
||||
package svg
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/anyproto/anytype-heart/core/files/mock_files"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/pb/storage"
|
||||
)
|
||||
|
||||
func TestProcessSvg(t *testing.T) {
|
||||
t.Run("process svg successful", func(t *testing.T) {
|
||||
// given
|
||||
svgContent := []byte(`<svg viewBox="0 0 100 100">
|
||||
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
|
||||
</svg>`)
|
||||
file := mock_files.NewMockFile(t)
|
||||
file.EXPECT().Reader(context.Background()).Return(bytes.NewReader(svgContent), nil)
|
||||
fileInfo := &storage.FileInfo{}
|
||||
file.EXPECT().Info().Return(fileInfo)
|
||||
|
||||
// when
|
||||
result, err := ProcessSvg(context.Background(), file)
|
||||
|
||||
// then
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, result)
|
||||
assert.Equal(t, svgMedia, fileInfo.Media)
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue