mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-11 02:13:41 +09:00
GO-4144: Fix tests
This commit is contained in:
parent
a2306fbeb3
commit
aa4df2fc4b
6 changed files with 20 additions and 20 deletions
|
@ -14,7 +14,7 @@ func newStruct() *domain.Details {
|
|||
"author": domain.String("William Shakespeare"),
|
||||
"haters": domain.StringList([]string{}),
|
||||
"year": domain.Int64(1564),
|
||||
"numbers": domain.Int64List(8, 13, 21, 34),
|
||||
"numbers": domain.Int64List([]int64{8, 13, 21, 34}),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -30,10 +30,10 @@ func TestAddValueToListDetail(t *testing.T) {
|
|||
{"string list + string list (intersect)", "tag", newStruct(), domain.StringList([]string{"blue", "black"}), domain.StringList([]string{"red", "black", "blue"})},
|
||||
{"string + string list", "author", newStruct(), domain.StringList([]string{"Victor Hugo"}), domain.StringList([]string{"William Shakespeare", "Victor Hugo"})},
|
||||
{"string list + string", "tag", newStruct(), domain.String("orange"), domain.StringList([]string{"red", "black", "orange"})},
|
||||
{"int list + int list", "numbers", newStruct(), domain.Int64List(55, 89), domain.Int64List(8, 13, 21, 34, 55, 89)},
|
||||
{"int list + int list (intersect)", "numbers", newStruct(), domain.Int64List(13, 8, 55), domain.Int64List(8, 13, 21, 34, 55)},
|
||||
{"int + int list", "year", newStruct(), domain.Int64List(1666, 2025), domain.Int64List(1564, 1666, 2025)},
|
||||
{"int list + int", "numbers", newStruct(), domain.Int64(55), domain.Int64List(8, 13, 21, 34, 55)},
|
||||
{"int list + int list", "numbers", newStruct(), domain.Int64List([]int64{55, 89}), domain.Int64List([]int64{8, 13, 21, 34, 55, 89})},
|
||||
{"int list + int list (intersect)", "numbers", newStruct(), domain.Int64List([]int64{13, 8, 55}), domain.Int64List([]int64{8, 13, 21, 34, 55})},
|
||||
{"int + int list", "year", newStruct(), domain.Int64List([]int64{1666, 2025}), domain.Int64List([]int64{1564, 1666, 2025})},
|
||||
{"int list + int", "numbers", newStruct(), domain.Int64(55), domain.Int64List([]int64{8, 13, 21, 34, 55})},
|
||||
{"string list + empty", "haters", newStruct(), domain.StringList([]string{"Tomas River", "Leo Tolstoy"}), domain.StringList([]string{"Tomas River", "Leo Tolstoy"})},
|
||||
{"string list + no such key", "plays", newStruct(), domain.StringList([]string{"Falstaff", "Romeo and Juliet", "Macbeth"}), domain.StringList([]string{"Falstaff", "Romeo and Juliet", "Macbeth"})},
|
||||
} {
|
||||
|
@ -56,10 +56,10 @@ func TestRemoveValueFromListDetail(t *testing.T) {
|
|||
{"string list - string list (some are not presented)", "tag", newStruct(), domain.StringList([]string{"blue", "black"}), domain.StringList([]string{"red"})},
|
||||
{"string list - string", "tag", newStruct(), domain.String("red"), domain.StringList([]string{"black"})},
|
||||
{"string - string list", "author", newStruct(), domain.StringList([]string{"William Shakespeare"}), domain.StringList([]string{})},
|
||||
{"int list - int list", "numbers", newStruct(), domain.Int64List(13, 34), domain.Int64List(8, 21)},
|
||||
{"int list - int list (some are not presented)", "numbers", newStruct(), domain.Int64List(2020, 5), domain.Int64List(8, 13, 21, 34)},
|
||||
{"int - int list", "year", newStruct(), domain.Int64List(1380, 1564), domain.Invalid()},
|
||||
{"int list - int", "numbers", newStruct(), domain.Int64(21), domain.Int64List(8, 13, 34)},
|
||||
{"int list - int list", "numbers", newStruct(), domain.Int64List([]int64{13, 34}), domain.Int64List([]int64{8, 21})},
|
||||
{"int list - int list (some are not presented)", "numbers", newStruct(), domain.Int64List([]int64{2020, 5}), domain.Int64List([]int64{8, 13, 21, 34})},
|
||||
{"int - int list", "year", newStruct(), domain.Int64List([]int64{1380, 1564}), domain.Invalid()},
|
||||
{"int list - int", "numbers", newStruct(), domain.Int64(21), domain.Int64List([]int64{8, 13, 34})},
|
||||
{"empty - string list", "haters", newStruct(), domain.StringList([]string{"Tomas River", "Leo Tolstoy"}), domain.StringList([]string{})},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
|
|
|
@ -214,7 +214,7 @@ func TestDataview_SetSourceInSet(t *testing.T) {
|
|||
Value: domain.StringList([]string{"rel-name", "rel-id"}),
|
||||
}, {
|
||||
Key: bundle.RelationKeyInternalFlags,
|
||||
Value: domain.Int64List(model.InternalFlag_editorDeleteEmpty),
|
||||
Value: domain.Int64List([]int64{int64(model.InternalFlag_editorDeleteEmpty)}),
|
||||
}}, false)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ func Test_removeInternalFlags(t *testing.T) {
|
|||
t.Run("no flags - no changes", func(t *testing.T) {
|
||||
// given
|
||||
st := state.NewDoc("test", nil).(*state.State)
|
||||
st.SetDetail(bundle.RelationKeyInternalFlags, domain.Int64List[int64]())
|
||||
st.SetDetail(bundle.RelationKeyInternalFlags, domain.Int64List([]int64{}))
|
||||
|
||||
// when
|
||||
removeInternalFlags(st)
|
||||
|
|
|
@ -571,7 +571,7 @@ func TestTextImpl_removeInternalFlags(t *testing.T) {
|
|||
sb := smarttest.New(rootID)
|
||||
sb.AddBlock(simple.New(&model.Block{Id: rootID, ChildrenIds: []string{blockID}})).
|
||||
AddBlock(newTextBlock(blockID, text))
|
||||
_ = sb.SetDetails(nil, []domain.Detail{{Key: bundle.RelationKeyInternalFlags, Value: domain.Int64List(0, 1, 2)}}, false)
|
||||
_ = sb.SetDetails(nil, []domain.Detail{{Key: bundle.RelationKeyInternalFlags, Value: domain.Int64List([]int64{0, 1, 2})}}, false)
|
||||
tb := NewText(sb, nil, nil)
|
||||
|
||||
// when
|
||||
|
@ -593,7 +593,7 @@ func TestTextImpl_removeInternalFlags(t *testing.T) {
|
|||
sb := smarttest.New(rootID)
|
||||
sb.AddBlock(simple.New(&model.Block{Id: rootID, ChildrenIds: []string{blockID}})).
|
||||
AddBlock(newTextBlock(blockID, text))
|
||||
_ = sb.SetDetails(nil, []domain.Detail{{Key: bundle.RelationKeyInternalFlags, Value: domain.Int64List(0, 1, 2)}}, false)
|
||||
_ = sb.SetDetails(nil, []domain.Detail{{Key: bundle.RelationKeyInternalFlags, Value: domain.Int64List([]int64{0, 1, 2})}}, false)
|
||||
tb := NewText(sb, nil, nil)
|
||||
|
||||
// when
|
||||
|
@ -615,7 +615,7 @@ func TestTextImpl_removeInternalFlags(t *testing.T) {
|
|||
sb := smarttest.New(rootID)
|
||||
sb.AddBlock(simple.New(&model.Block{Id: rootID, ChildrenIds: []string{blockID}})).
|
||||
AddBlock(newTextBlock(blockID, text))
|
||||
_ = sb.SetDetails(nil, []domain.Detail{{Key: bundle.RelationKeyInternalFlags, Value: domain.Int64List(0, 1, 2)}}, false)
|
||||
_ = sb.SetDetails(nil, []domain.Detail{{Key: bundle.RelationKeyInternalFlags, Value: domain.Int64List([]int64{0, 1, 2})}}, false)
|
||||
tb := NewText(sb, nil, nil)
|
||||
|
||||
// when
|
||||
|
@ -638,7 +638,7 @@ func TestTextImpl_removeInternalFlags(t *testing.T) {
|
|||
sb := smarttest.New(rootID)
|
||||
sb.AddBlock(simple.New(&model.Block{Id: rootID, ChildrenIds: []string{template.TitleBlockId}})).
|
||||
AddBlock(newTextBlock(template.TitleBlockId, text))
|
||||
_ = sb.SetDetails(nil, []domain.Detail{{Key: bundle.RelationKeyInternalFlags, Value: domain.Int64List(0, 1, 2)}}, false)
|
||||
_ = sb.SetDetails(nil, []domain.Detail{{Key: bundle.RelationKeyInternalFlags, Value: domain.Int64List([]int64{0, 1, 2})}}, false)
|
||||
tb := NewText(sb, nil, nil)
|
||||
|
||||
// when
|
||||
|
|
|
@ -374,7 +374,7 @@ func TestBuildTemplateStateFromObject(t *testing.T) {
|
|||
obj := smarttest.New("object")
|
||||
err := obj.SetDetails(nil, []domain.Detail{{
|
||||
Key: bundle.RelationKeyInternalFlags,
|
||||
Value: domain.Int64List(0, 1, 2, 3),
|
||||
Value: domain.Int64List([]int64{0, 1, 2, 3}),
|
||||
}}, false)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
|
|
@ -537,7 +537,7 @@ func TestQuery(t *testing.T) {
|
|||
Operator: 0,
|
||||
RelationKey: "layout",
|
||||
Condition: model.BlockContentDataviewFilter_NotIn,
|
||||
Value: domain.Int64List(int(model.ObjectType_relationOption)),
|
||||
Value: domain.Int64List([]int64{int64(model.ObjectType_relationOption)}),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
@ -561,7 +561,7 @@ func TestQuery(t *testing.T) {
|
|||
Operator: 0,
|
||||
RelationKey: "layout",
|
||||
Condition: model.BlockContentDataviewFilter_NotIn,
|
||||
Value: domain.Int64List(int(model.ObjectType_relationOption)),
|
||||
Value: domain.Int64List([]int64{int64(model.ObjectType_relationOption)}),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
@ -578,7 +578,7 @@ func TestQuery(t *testing.T) {
|
|||
Operator: 0,
|
||||
RelationKey: "layout",
|
||||
Condition: model.BlockContentDataviewFilter_NotIn,
|
||||
Value: domain.Int64List(int(model.ObjectType_relationOption)),
|
||||
Value: domain.Int64List([]int64{int64(model.ObjectType_relationOption)}),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
@ -595,7 +595,7 @@ func TestQuery(t *testing.T) {
|
|||
Operator: 0,
|
||||
RelationKey: "layout",
|
||||
Condition: model.BlockContentDataviewFilter_NotIn,
|
||||
Value: domain.Int64List(int(model.ObjectType_objectType)),
|
||||
Value: domain.Int64List([]int64{int64(model.ObjectType_objectType)}),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue