mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-09 09:35:00 +09:00
GO-4316: Add tests
This commit is contained in:
parent
5ccd6dd09d
commit
1e1563f9ae
4 changed files with 207 additions and 5 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/globalsign/mgo/bson"
|
||||
"github.com/gogo/protobuf/types"
|
||||
|
||||
"github.com/anyproto/anytype-heart/core/block/simple"
|
||||
"github.com/anyproto/anytype-heart/pkg/lib/pb/model"
|
||||
"github.com/anyproto/anytype-heart/util/pbtypes"
|
||||
)
|
||||
|
@ -53,6 +54,15 @@ func (b *Block) Build() []*model.Block {
|
|||
}, descendants...)
|
||||
}
|
||||
|
||||
func (b *Block) BuildMap() map[string]simple.Block {
|
||||
blocks := b.Build()
|
||||
res := make(map[string]simple.Block, len(blocks))
|
||||
for _, bl := range blocks {
|
||||
res[bl.Id] = simple.New(bl)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func mkBlock(b *model.Block, opts ...Option) *Block {
|
||||
o := options{
|
||||
// Init children for easier equality check in tests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue