From eafd87c2349b6d8028da0a15cf60527aef41ce78 Mon Sep 17 00:00:00 2001 From: Evgenii Kozlov Date: Wed, 19 Apr 2023 17:52:57 +0200 Subject: [PATCH] DROID-1147 App | Refactoring | Remove or deprecate SmartBlockType (#3104) --- .../features/editor/CreateBlockTesting.kt | 6 +- .../features/editor/DeleteBlockTesting.kt | 6 +- .../features/editor/DescriptionTesting.kt | 4 +- .../editor/EditorIntegrationTesting.kt | 15 ++- .../editor/FeaturedRelationTesting.kt | 4 +- .../anytype/features/editor/LayoutTesting.kt | 15 ++- .../features/editor/ListBlockTesting.kt | 8 +- .../anytype/features/editor/MarkupTesting.kt | 2 +- .../features/editor/MentionUpdateTesting.kt | 4 +- .../features/editor/MergeBlockTesting.kt | 4 +- .../anytype/features/editor/ProfileTesting.kt | 3 +- .../features/editor/RelationBlockUITesting.kt | 22 ++-- .../features/editor/ScrollAndMoveTesting.kt | 2 +- .../editor/SlashTextWatcherTesting.kt | 18 ++-- .../features/editor/SlashWidgetTesting.kt | 30 +++--- .../features/editor/SplitBlockTesting.kt | 20 ++-- .../features/editor/SplitTitleTesting.kt | 6 +- .../features/editor/base/EditorTestSetup.kt | 7 -- .../editor/base/MentionWidgetTesting.kt | 9 +- .../DisplayRelationObjectValueTest.kt | 6 -- .../dv/ObjectSetGridColumnRenderingTest.kt | 20 +--- .../dv/ObjectSetGridFileCellRenderingTest.kt | 5 +- .../ObjectSetGridNumberCellRenderingTest.kt | 25 ++--- .../ObjectSetGridObjectCellRenderingTest.kt | 27 +---- .../dv/ObjectSetGridPrimitiveRelationTest.kt | 20 +--- .../dv/ObjectSetGridTagCellRenderingTest.kt | 22 +--- .../features/sets/dv/ObjectSetHeaderTest.kt | 3 +- .../features/sets/dv/TestObjectSetSetup.kt | 7 +- .../anytype/app/DefaultFeatureToggles.kt | 19 +--- .../anytypeio/anytype/core_models/Block.kt | 2 +- .../anytypeio/anytype/core_models/Event.kt | 2 - .../anytype/core_models/ObjectType.kt | 4 +- .../anytype/core_models/ObjectView.kt | 1 - .../anytype/core_models/ObjectWrapper.kt | 10 -- .../anytypeio/anytype/core_models/PageLink.kt | 23 ---- .../anytype/core_models/Relations.kt | 2 + .../anytype/core_models/SmartBlockType.kt | 1 + .../auth/repo/block/BlockDataRepository.kt | 8 -- .../data/auth/repo/block/BlockDataStore.kt | 6 -- .../data/auth/repo/block/BlockRemote.kt | 6 -- .../auth/repo/block/BlockRemoteDataStore.kt | 7 -- .../domain/block/repo/BlockRepository.kt | 5 - .../anytype/domain/ext/BlockExtensionTest.kt | 21 ++-- .../middleware/block/BlockMiddleware.kt | 11 -- .../middleware/interactor/Middleware.kt | 28 ----- .../middleware/mappers/ToCoreModelMappers.kt | 102 +++++------------- .../mappers/ToCoreModelMappersTest.kt | 12 +-- .../anytype/presentation/editor/Editor.kt | 1 - .../presentation/editor/EditorViewModel.kt | 61 +++-------- .../editor/render/DefaultBlockViewRenderer.kt | 29 +---- .../presentation/mapper/MapperExtension.kt | 21 ---- .../presentation/moving/MoveToViewModel.kt | 28 +++-- .../objects/ObjectTypeChangeViewModel.kt | 18 ++++ .../objects/ObjectTypeExtensions.kt | 9 +- .../presentation/objects/SupportedLayouts.kt | 12 +++ .../search/ObjectSearchConstants.kt | 3 +- .../settings/OtherSettingsViewModel.kt | 5 - .../MockTypicalDocumentFactory.kt | 4 +- .../presentation/editor/BlockReadModeTest.kt | 4 +- .../DataViewBlockTargetObjectSetTest.kt | 14 +-- .../editor/DefaultBlockViewRendererTest.kt | 73 ++++++------- .../DocumentExternalEventReducerTest.kt | 7 +- .../editor/EditorViewModelTest.kt | 73 +++++++------ .../editor/EditorBackspaceDeleteTest.kt | 40 +++---- .../editor/editor/EditorBlockActionsTest.kt | 14 +-- .../editor/editor/EditorCheckboxTest.kt | 5 +- .../editor/editor/EditorCreateBlockTest.kt | 2 +- .../editor/editor/EditorDuplicateTest.kt | 8 +- .../editor/EditorEmptySpaceInteractionTest.kt | 9 +- .../editor/editor/EditorErrorMessageTest.kt | 3 +- .../editor/EditorEventSubscriptionTest.kt | 2 +- .../editor/EditorFeaturedRelationsTest.kt | 17 ++- .../editor/editor/EditorFocusTest.kt | 18 ++-- .../editor/editor/EditorGranularChangeTest.kt | 2 +- .../editor/editor/EditorLatexBlockTest.kt | 4 +- .../editor/editor/EditorListBlockTest.kt | 17 ++- .../editor/editor/EditorLockPageTest.kt | 19 ++-- .../editor/editor/EditorMarkupObjectTest.kt | 9 +- .../editor/editor/EditorMentionTest.kt | 18 ++-- .../editor/editor/EditorMenuTest.kt | 27 ----- .../editor/editor/EditorMergeTest.kt | 9 +- .../editor/EditorMultiSelectModeTest.kt | 36 +++---- .../editor/editor/EditorNoteLayoutTest.kt | 9 +- .../EditorObjectTypeChangeWidgetTest.kt | 12 +-- .../EditorQuickStartingScrollAndMoveTest.kt | 6 +- .../editor/editor/EditorRelationBlockTest.kt | 11 +- .../editor/editor/EditorScrollAndMoveTest.kt | 20 ++-- .../editor/EditorSlashWidgetActionsTest.kt | 8 +- .../editor/EditorSlashWidgetClicksTest.kt | 8 +- .../editor/EditorSlashWidgetColorTest.kt | 18 ++-- .../editor/EditorSlashWidgetCutFilterTest.kt | 2 +- .../editor/EditorSlashWidgetMarksTest.kt | 24 ++--- .../editor/EditorSlashWidgetRelationsTest.kt | 6 +- .../editor/EditorSlashWidgetStyleTypeTest.kt | 10 +- .../editor/editor/EditorSplitTest.kt | 4 +- .../editor/editor/EditorStartupTest.kt | 2 +- .../editor/EditorTableOfContentsBlockTest.kt | 11 +- .../editor/editor/EditorTextUpdateTest.kt | 9 +- .../editor/editor/EditorTitleAddBlockTest.kt | 16 +-- .../editor/editor/EditorTitleTest.kt | 12 +-- .../editor/editor/EditorTurnIntoTest.kt | 2 +- .../EditorStyleBackgroundToolbarTest.kt | 11 +- .../editor/table/TableBlockRendererTest.kt | 12 +-- .../home/HomeScreenViewModelTest.kt | 31 ------ .../search/ObjectSearchExtensionsTest.kt | 87 --------------- .../sets/main/ObjectSetViewModelTestSetup.kt | 7 +- .../types/ObjectTypeChangeViewModelTest.kt | 95 ++++++++++++++-- .../anytypeio/anytype/core_models/Block.kt | 5 +- .../anytypeio/anytype/core_models/Object.kt | 2 - .../anytype/presentation/MockBlockFactory.kt | 3 +- 110 files changed, 615 insertions(+), 1039 deletions(-) delete mode 100644 core-models/src/main/java/com/anytypeio/anytype/core_models/PageLink.kt delete mode 100644 presentation/src/test/java/com/anytypeio/anytype/presentation/search/ObjectSearchExtensionsTest.kt diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/CreateBlockTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/CreateBlockTesting.kt index b90bd3d7a4..dfe6fd626a 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/CreateBlockTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/CreateBlockTesting.kt @@ -28,6 +28,7 @@ import com.anytypeio.anytype.test_utils.utils.TestUtils import com.anytypeio.anytype.ui.editor.EditorFragment import com.anytypeio.anytype.utils.CoroutinesTestRule import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test @@ -36,7 +37,6 @@ import org.mockito.kotlin.doReturn import org.mockito.kotlin.stub import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertEquals @RunWith(AndroidJUnit4::class) @LargeTest @@ -130,7 +130,7 @@ class CreateBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id) ) @@ -236,7 +236,7 @@ class CreateBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/DeleteBlockTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/DeleteBlockTesting.kt index 937f96eb9e..903e91e6b9 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/DeleteBlockTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/DeleteBlockTesting.kt @@ -29,6 +29,7 @@ import com.anytypeio.anytype.test_utils.utils.TestUtils.withRecyclerView import com.anytypeio.anytype.ui.editor.EditorFragment import com.anytypeio.anytype.utils.CoroutinesTestRule import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test @@ -37,7 +38,6 @@ import org.mockito.kotlin.doReturn import org.mockito.kotlin.stub import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertEquals @RunWith(AndroidJUnit4::class) @LargeTest @@ -287,7 +287,7 @@ class DeleteBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id) ) @@ -508,7 +508,7 @@ class DeleteBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/DescriptionTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/DescriptionTesting.kt index b9a29b5c59..3e0bd12794 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/DescriptionTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/DescriptionTesting.kt @@ -74,7 +74,7 @@ class DescriptionTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ) @@ -113,7 +113,7 @@ class DescriptionTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/EditorIntegrationTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/EditorIntegrationTesting.kt index 80894cf343..7215b5b2c0 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/EditorIntegrationTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/EditorIntegrationTesting.kt @@ -21,7 +21,6 @@ import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.BlockSplitMode import com.anytypeio.anytype.core_models.Command import com.anytypeio.anytype.core_models.Event -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_ui.features.editor.holders.text.Checkbox import com.anytypeio.anytype.core_ui.features.editor.holders.text.Numbered import com.anytypeio.anytype.core_ui.features.editor.holders.text.Toggle @@ -99,7 +98,7 @@ class EditorIntegrationTesting : EditorTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = blocks.map { it.id } ) ) + blocks @@ -162,7 +161,7 @@ class EditorIntegrationTesting : EditorTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf( BLOCK_PARAGRAPH_1.id ) @@ -208,7 +207,7 @@ class EditorIntegrationTesting : EditorTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf( BLOCK_PARAGRAPH_1.id ) @@ -256,7 +255,7 @@ class EditorIntegrationTesting : EditorTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(paragraph.id) ), paragraph @@ -394,7 +393,7 @@ class EditorIntegrationTesting : EditorTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(paragraphBefore.id, paragraphAfter.id) ), paragraphBefore, @@ -504,7 +503,7 @@ class EditorIntegrationTesting : EditorTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(paragraph1.id, paragraph2.id) ), paragraph1, @@ -606,7 +605,7 @@ class EditorIntegrationTesting : EditorTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(paragraph.id) ), paragraph diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/FeaturedRelationTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/FeaturedRelationTesting.kt index ad518c5669..0f0e811822 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/FeaturedRelationTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/FeaturedRelationTesting.kt @@ -132,7 +132,7 @@ class FeaturedRelationTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id, block1.id) ) @@ -235,7 +235,7 @@ class FeaturedRelationTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id, block1.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/LayoutTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/LayoutTesting.kt index 0069d5b929..9215a337f4 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/LayoutTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/LayoutTesting.kt @@ -7,7 +7,6 @@ import com.anytypeio.anytype.R import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.CoverType import com.anytypeio.anytype.core_models.ObjectType -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider import com.anytypeio.anytype.features.editor.base.EditorTestSetup @@ -74,7 +73,7 @@ class LayoutTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -125,7 +124,7 @@ class LayoutTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -171,7 +170,7 @@ class LayoutTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -218,7 +217,7 @@ class LayoutTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -263,7 +262,7 @@ class LayoutTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -310,7 +309,7 @@ class LayoutTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -355,7 +354,7 @@ class LayoutTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ListBlockTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ListBlockTesting.kt index a20c1ccb3b..23cbfb1231 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ListBlockTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ListBlockTesting.kt @@ -14,7 +14,6 @@ import com.anytypeio.anytype.core_models.BlockSplitMode import com.anytypeio.anytype.core_models.Command import com.anytypeio.anytype.core_models.Event import com.anytypeio.anytype.core_models.Payload -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.core_ui.widgets.text.TextInputWidget import com.anytypeio.anytype.domain.base.Either @@ -29,15 +28,14 @@ import com.anytypeio.anytype.presentation.editor.EditorViewModel import com.anytypeio.anytype.test_utils.utils.TestUtils import com.anytypeio.anytype.ui.editor.EditorFragment import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test -import org.mockito.kotlin.doAnswer import org.mockito.kotlin.doReturn import org.mockito.kotlin.stub import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertEquals class ListBlockTesting : EditorTestSetup() { @@ -112,7 +110,7 @@ class ListBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(a.id) ) @@ -273,7 +271,7 @@ class ListBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MarkupTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MarkupTesting.kt index 4678dafc41..b376fd4a54 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MarkupTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MarkupTesting.kt @@ -88,7 +88,7 @@ class MarkupTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MentionUpdateTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MentionUpdateTesting.kt index 3c1b022797..6a02198fd7 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MentionUpdateTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MentionUpdateTesting.kt @@ -10,7 +10,6 @@ import com.anytypeio.anytype.R import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Event import com.anytypeio.anytype.core_models.Payload -import com.anytypeio.anytype.domain.base.Either import com.anytypeio.anytype.domain.base.Result import com.anytypeio.anytype.domain.base.Resultat import com.anytypeio.anytype.features.editor.base.EditorTestSetup @@ -29,7 +28,6 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.any -import org.mockito.kotlin.doAnswer import org.mockito.kotlin.doReturn import org.mockito.kotlin.stub @@ -103,7 +101,7 @@ class MentionUpdateTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) val document = listOf(page, header, title, block) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MergeBlockTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MergeBlockTesting.kt index 2e01ed9600..d422bb0718 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MergeBlockTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/MergeBlockTesting.kt @@ -27,6 +27,7 @@ import com.anytypeio.anytype.test_utils.utils.TestUtils.withRecyclerView import com.anytypeio.anytype.ui.editor.EditorFragment import com.anytypeio.anytype.utils.CoroutinesTestRule import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test @@ -36,7 +37,6 @@ import org.mockito.kotlin.doReturn import org.mockito.kotlin.stub import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertEquals @RunWith(AndroidJUnit4::class) @LargeTest @@ -214,7 +214,7 @@ class MergeBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ProfileTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ProfileTesting.kt index 5f5e146c92..b69a101fe8 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ProfileTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ProfileTesting.kt @@ -9,7 +9,6 @@ import com.anytypeio.anytype.R import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.CoverType import com.anytypeio.anytype.core_models.ObjectType -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.features.editor.base.EditorTestSetup import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent @@ -58,7 +57,7 @@ class ProfileTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/RelationBlockUITesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/RelationBlockUITesting.kt index a93d69645b..ed12ae8100 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/RelationBlockUITesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/RelationBlockUITesting.kt @@ -12,6 +12,7 @@ import androidx.test.filters.LargeTest import com.anytypeio.anytype.R import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Relation +import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.core_ui.extensions.veryLight import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider @@ -19,7 +20,6 @@ import com.anytypeio.anytype.features.editor.base.EditorTestSetup import com.anytypeio.anytype.features.editor.base.TestEditorFragment import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent import com.anytypeio.anytype.presentation.editor.EditorViewModel -import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.test_utils.MockDataFactory import com.anytypeio.anytype.test_utils.utils.checkHasBackgroundColor import com.anytypeio.anytype.test_utils.utils.checkHasNoBackground @@ -114,7 +114,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id) ) @@ -248,7 +248,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf( header.id, paragraph.id, @@ -424,7 +424,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf( header.id, paragraph.id, @@ -514,7 +514,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id) ) @@ -603,7 +603,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id) ) @@ -659,7 +659,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id, block.id) ) @@ -725,7 +725,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -857,7 +857,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -939,7 +939,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -1075,7 +1075,7 @@ class RelationBlockUITesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf( header.id, paragraph.id, diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ScrollAndMoveTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ScrollAndMoveTesting.kt index 5f85e1d2c3..2d4d0a587c 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ScrollAndMoveTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/ScrollAndMoveTesting.kt @@ -92,7 +92,7 @@ class ScrollAndMoveTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SlashTextWatcherTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SlashTextWatcherTesting.kt index 06284a4ba3..125147bde0 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SlashTextWatcherTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SlashTextWatcherTesting.kt @@ -84,7 +84,7 @@ class SlashTextWatcherTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -115,7 +115,7 @@ class SlashTextWatcherTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -148,7 +148,7 @@ class SlashTextWatcherTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -179,7 +179,7 @@ class SlashTextWatcherTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -211,7 +211,7 @@ class SlashTextWatcherTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -244,7 +244,7 @@ class SlashTextWatcherTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -275,7 +275,7 @@ class SlashTextWatcherTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -308,7 +308,7 @@ class SlashTextWatcherTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -347,7 +347,7 @@ class SlashTextWatcherTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id, paragraph2.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SlashWidgetTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SlashWidgetTesting.kt index c756c4e449..b927e2fa7a 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SlashWidgetTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SlashWidgetTesting.kt @@ -122,7 +122,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -163,7 +163,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -204,7 +204,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -250,7 +250,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -296,7 +296,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -342,7 +342,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -388,7 +388,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -472,7 +472,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -539,7 +539,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id, paragraph2.id) ) @@ -612,7 +612,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id, paragraph2.id) ) @@ -691,7 +691,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id, paragraph2.id) ) @@ -761,7 +761,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id, paragraph2.id) ) @@ -825,7 +825,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -873,7 +873,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -910,7 +910,7 @@ class SlashWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SplitBlockTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SplitBlockTesting.kt index 627853b819..675fc6a325 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SplitBlockTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SplitBlockTesting.kt @@ -25,6 +25,7 @@ import com.anytypeio.anytype.test_utils.utils.TestUtils.withRecyclerView import com.anytypeio.anytype.ui.editor.EditorFragment import com.anytypeio.anytype.utils.CoroutinesTestRule import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test @@ -32,7 +33,6 @@ import org.junit.runner.RunWith import org.mockito.kotlin.any import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertEquals @RunWith(AndroidJUnit4::class) @LargeTest @@ -77,7 +77,7 @@ class SplitBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(block.id) ) @@ -220,7 +220,7 @@ class SplitBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(block.id) ) @@ -361,7 +361,7 @@ class SplitBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(block.id) ) @@ -502,7 +502,7 @@ class SplitBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(block.id) ) @@ -643,7 +643,7 @@ class SplitBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(block.id) ) @@ -786,7 +786,7 @@ class SplitBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(block.id) ) @@ -929,7 +929,7 @@ class SplitBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(block.id) ) @@ -1072,7 +1072,7 @@ class SplitBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(block.id) ) @@ -1215,7 +1215,7 @@ class SplitBlockTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(block.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SplitTitleTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SplitTitleTesting.kt index 95cfcd5abb..8de74f6eee 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SplitTitleTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/SplitTitleTesting.kt @@ -30,13 +30,13 @@ import com.anytypeio.anytype.test_utils.utils.rVMatcher import com.anytypeio.anytype.ui.editor.EditorFragment import com.anytypeio.anytype.utils.CoroutinesTestRule import com.bartoszlipinski.disableanimationsrule.DisableAnimationsRule +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertEquals @RunWith(AndroidJUnit4::class) @LargeTest @@ -104,7 +104,7 @@ class SplitTitleTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) val relation2 = Relation( @@ -214,7 +214,7 @@ class SplitTitleTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) val relation2 = Relation( diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/base/EditorTestSetup.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/base/EditorTestSetup.kt index 788f24e195..e60b6d638e 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/base/EditorTestSetup.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/base/EditorTestSetup.kt @@ -8,7 +8,6 @@ import com.anytypeio.anytype.analytics.base.Analytics import com.anytypeio.anytype.app.DefaultFeatureToggles import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Command -import com.anytypeio.anytype.core_models.DocumentInfo import com.anytypeio.anytype.core_models.Event import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.ObjectWrapper @@ -547,12 +546,6 @@ open class EditorTestSetup { } } - fun stubGetListPages(pages: List) { - repo.stub { - onBlocking { getListPages() } doReturn pages - } - } - fun stubUpdateTextStyle( events: List = emptyList() ) { diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/base/MentionWidgetTesting.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/base/MentionWidgetTesting.kt index 41b35282c7..0942a556e1 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/editor/base/MentionWidgetTesting.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/editor/base/MentionWidgetTesting.kt @@ -91,7 +91,7 @@ class MentionWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -100,7 +100,6 @@ class MentionWidgetTesting : EditorTestSetup() { stubInterceptEvents() stubInterceptThreadStatus() stubUpdateText() - stubGetListPages(listOf()) stubOpenDocument(document, defaultDetails) launchFragment(args) @@ -142,7 +141,7 @@ class MentionWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -151,7 +150,6 @@ class MentionWidgetTesting : EditorTestSetup() { stubInterceptEvents() stubInterceptThreadStatus() stubUpdateText() - stubGetListPages(listOf()) stubOpenDocument(document, defaultDetails) launchFragment(args) @@ -194,7 +192,7 @@ class MentionWidgetTesting : EditorTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -203,7 +201,6 @@ class MentionWidgetTesting : EditorTestSetup() { stubInterceptEvents() stubInterceptThreadStatus() stubUpdateText() - stubGetListPages(listOf()) stubOpenDocument(document, defaultDetails) launchFragment(args) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/relations/DisplayRelationObjectValueTest.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/relations/DisplayRelationObjectValueTest.kt index 4b2df0c25b..7a7496c560 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/relations/DisplayRelationObjectValueTest.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/relations/DisplayRelationObjectValueTest.kt @@ -301,7 +301,6 @@ class DisplayRelationObjectValueTest { layout = ObjectType.Layout.values().random(), description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -314,7 +313,6 @@ class DisplayRelationObjectValueTest { layout = ObjectType.Layout.values().random(), description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -405,7 +403,6 @@ class DisplayRelationObjectValueTest { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -418,7 +415,6 @@ class DisplayRelationObjectValueTest { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -509,7 +505,6 @@ class DisplayRelationObjectValueTest { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -522,7 +517,6 @@ class DisplayRelationObjectValueTest { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridColumnRenderingTest.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridColumnRenderingTest.kt index 6e702516ae..2ca9cc1789 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridColumnRenderingTest.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridColumnRenderingTest.kt @@ -6,9 +6,7 @@ import androidx.test.filters.LargeTest import com.anytypeio.anytype.R import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.DVViewerRelation -import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.Relation -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent import com.anytypeio.anytype.test_utils.MockDataFactory import com.anytypeio.anytype.test_utils.utils.checkHasText @@ -48,19 +46,6 @@ class ObjectSetGridColumnRenderingTest : TestObjectSetSetup() { @Test fun shouldRenderAllColumnHeaderNamesBasedOnViewerRelations() { - val type = ObjectType( - url = MockDataFactory.randomUuid(), - name = MockDataFactory.randomString(), - emoji = MockDataFactory.randomString(), - layout = ObjectType.Layout.BASIC, - relationLinks = emptyList(), - description = "", - isHidden = false, - smartBlockTypes = listOf(), - isArchived = false, - isReadOnly = false - ) - val relation1 = Relation( key = MockDataFactory.randomString(), name = "Description", @@ -139,7 +124,7 @@ class ObjectSetGridColumnRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -150,8 +135,7 @@ class ObjectSetGridColumnRenderingTest : TestObjectSetSetup() { stubOpenObjectSetWithRecord( set = set, relations = listOf(relation1, relation2, relation3, relation4, relation5), - details = defaultDetails, - objectTypes = listOf(type) + details = defaultDetails ) // TESTING diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridFileCellRenderingTest.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridFileCellRenderingTest.kt index c5aa3da6f9..ab45ea8165 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridFileCellRenderingTest.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridFileCellRenderingTest.kt @@ -10,7 +10,6 @@ import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.DVViewerRelation import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.Relation -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent import com.anytypeio.anytype.presentation.relations.ObjectSetConfig @@ -70,7 +69,6 @@ class ObjectSetGridFileCellRenderingTest : TestObjectSetSetup() { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -148,7 +146,7 @@ class ObjectSetGridFileCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -160,7 +158,6 @@ class ObjectSetGridFileCellRenderingTest : TestObjectSetSetup() { set = set, relations = listOf(relation), details = details, - objectTypes = listOf(objectType) ) // TESTING diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridNumberCellRenderingTest.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridNumberCellRenderingTest.kt index 9934cce01c..65fa53949b 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridNumberCellRenderingTest.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridNumberCellRenderingTest.kt @@ -8,7 +8,6 @@ import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.DVViewerRelation import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.Relation -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent import com.anytypeio.anytype.presentation.relations.ObjectSetConfig @@ -67,7 +66,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -114,7 +112,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -125,7 +123,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { stubOpenObjectSetWithRecord( set = set, relations = listOf(relation), - objectTypes = listOf(objectType) ) // TESTING @@ -163,7 +160,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -210,7 +206,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -221,7 +217,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { stubOpenObjectSetWithRecord( set = set, relations = listOf(relation), - objectTypes = listOf(objectType) ) // TESTING @@ -259,7 +254,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -306,7 +300,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -317,7 +311,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { stubOpenObjectSetWithRecord( set = set, relations = listOf(relation), - objectTypes = listOf(objectType) ) // TESTING @@ -355,7 +348,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -402,7 +394,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -413,7 +405,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { stubOpenObjectSetWithRecord( set = set, relations = listOf(relation), - objectTypes = listOf(objectType) ) // TESTING @@ -451,7 +442,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -498,7 +488,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -509,7 +499,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { stubOpenObjectSetWithRecord( set = set, relations = listOf(relation), - objectTypes = listOf(objectType) ) // TESTING @@ -547,7 +536,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -594,7 +582,7 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -605,7 +593,6 @@ class ObjectSetGridNumberCellRenderingTest : TestObjectSetSetup() { stubOpenObjectSetWithRecord( set = set, relations = listOf(relation), - objectTypes = listOf(objectType) ) // TESTING diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridObjectCellRenderingTest.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridObjectCellRenderingTest.kt index 6efd4e0dc6..4478044ce9 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridObjectCellRenderingTest.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridObjectCellRenderingTest.kt @@ -11,7 +11,6 @@ import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.DVViewerRelation import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.Relation -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent import com.anytypeio.anytype.presentation.relations.ObjectSetConfig @@ -61,19 +60,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() { val object2Name = "Jean-Pierre Léaud" val object2Id = MockDataFactory.randomUuid() - val objectType = ObjectType( - url = MockDataFactory.randomUuid(), - name = "Movie", - relationLinks = emptyList(), - emoji = MockDataFactory.randomString(), - layout = ObjectType.Layout.PROFILE, - description = "", - isHidden = false, - smartBlockTypes = listOf(), - isArchived = false, - isReadOnly = false - ) - val relationId = MockDataFactory.randomUuid() val record1Id = MockDataFactory.randomUuid() val record2Id = MockDataFactory.randomUuid() @@ -82,7 +68,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() { ObjectSetConfig.ID_KEY to record1Id, ObjectSetConfig.NAME_KEY to "The Great Dictator", ObjectSetConfig.EMOJI_KEY to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(), - ObjectSetConfig.TYPE_KEY to objectType.url, relationId to object1Id ) @@ -90,7 +75,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() { ObjectSetConfig.ID_KEY to record2Id, ObjectSetConfig.NAME_KEY to "Les Quatre Cents Coups", ObjectSetConfig.EMOJI_KEY to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(), - ObjectSetConfig.TYPE_KEY to objectType.url, relationId to object2Id ) @@ -130,14 +114,12 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() { object1Id to Block.Fields( mapOf( ObjectSetConfig.NAME_KEY to object1Name, - ObjectSetConfig.TYPE_KEY to objectType.url, "iconEmoji" to "👤" ) ), object2Id to Block.Fields( mapOf( ObjectSetConfig.NAME_KEY to object2Name, - ObjectSetConfig.TYPE_KEY to objectType.url, "iconEmoji" to "👤" ) ) @@ -147,7 +129,7 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -158,8 +140,7 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() { stubOpenObjectSetWithRecord( set = set, relations = listOf(relation), - details = details, - objectTypes = listOf(objectType) + details = details ) // TESTING @@ -194,7 +175,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() { layout = ObjectType.Layout.PROFILE, description = "", isHidden = false, - smartBlockTypes = listOf(), isArchived = false, isReadOnly = false ) @@ -263,7 +243,7 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -275,7 +255,6 @@ class ObjectSetGridObjectCellRenderingTest : TestObjectSetSetup() { set = set, relations = listOf(relation), details = details, - objectTypes = listOf(objectType) ) // TESTING diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridPrimitiveRelationTest.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridPrimitiveRelationTest.kt index 2dadde240b..68dda6a528 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridPrimitiveRelationTest.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridPrimitiveRelationTest.kt @@ -6,9 +6,7 @@ import androidx.test.filters.LargeTest import com.anytypeio.anytype.R import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.DVViewerRelation -import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.Relation -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent import com.anytypeio.anytype.presentation.relations.ObjectSetConfig @@ -52,19 +50,6 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() { @Test fun shouldRenderAllObjectPrimitiveRelationsValuesFromTwoRecords() { - val type = ObjectType( - url = MockDataFactory.randomUuid(), - name = MockDataFactory.randomString(), - emoji = MockDataFactory.randomString(), - layout = ObjectType.Layout.BASIC, - relationLinks = emptyList(), - description = "", - isHidden = false, - smartBlockTypes = listOf(), - isArchived = false, - isReadOnly = false - ) - val relation1 = Relation( key = MockDataFactory.randomString(), name = "Description", @@ -114,7 +99,6 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() { val record1 = mapOf( ObjectSetConfig.ID_KEY to MockDataFactory.randomUuid(), - ObjectSetConfig.TYPE_KEY to type.url, ObjectSetConfig.NAME_KEY to "Anytype", "iconEmoji" to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(), relation1.key to object1value1, @@ -126,7 +110,6 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() { val record2 = mapOf( ObjectSetConfig.ID_KEY to MockDataFactory.randomUuid(), - ObjectSetConfig.TYPE_KEY to type.url, ObjectSetConfig.NAME_KEY to "IPFS", "iconEmoji" to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(), relation1.key to object2value1, @@ -179,7 +162,7 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -191,7 +174,6 @@ class ObjectSetGridPrimitiveRelationTest : TestObjectSetSetup() { set = set, relations = listOf(relation1, relation2, relation3, relation4, relation5), details = defaultDetails, - objectTypes = listOf(type) ) // TESTING diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridTagCellRenderingTest.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridTagCellRenderingTest.kt index 267ab10791..749c07f38e 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridTagCellRenderingTest.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetGridTagCellRenderingTest.kt @@ -8,9 +8,7 @@ import androidx.test.filters.LargeTest import com.anytypeio.anytype.R import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.DVViewerRelation -import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.Relation -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.emojifier.data.DefaultDocumentEmojiIconProvider import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent import com.anytypeio.anytype.presentation.relations.ObjectSetConfig @@ -63,19 +61,6 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() { val tag3Name = "Director" val tag3Id = MockDataFactory.randomUuid() - val objectType = ObjectType( - url = MockDataFactory.randomUuid(), - name = "Film", - relationLinks = emptyList(), - emoji = MockDataFactory.randomString(), - layout = ObjectType.Layout.BASIC , - description = "", - isHidden = false, - smartBlockTypes = listOf(), - isArchived = false, - isReadOnly = false - ) - val relationId = MockDataFactory.randomUuid() val record1Id = MockDataFactory.randomUuid() val record2Id = MockDataFactory.randomUuid() @@ -84,7 +69,6 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() { ObjectSetConfig.ID_KEY to record1Id, ObjectSetConfig.NAME_KEY to "The Face on the Bar Room Floor", ObjectSetConfig.EMOJI_KEY to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(), - ObjectSetConfig.TYPE_KEY to objectType.url, relationId to listOf(tag1Id, tag3Id) ) @@ -92,7 +76,6 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() { ObjectSetConfig.ID_KEY to record2Id, ObjectSetConfig.NAME_KEY to "The Great Dictator", ObjectSetConfig.EMOJI_KEY to DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random(), - ObjectSetConfig.TYPE_KEY to objectType.url, relationId to listOf(tag2Id, tag3Id) ) @@ -142,7 +125,7 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) @@ -153,8 +136,7 @@ class ObjectSetGridTagCellRenderingTest : TestObjectSetSetup() { stubOpenObjectSetWithRecord( set = set, relations = listOf(relation), - details = details, - objectTypes = listOf(objectType) + details = details ) // TESTING diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetHeaderTest.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetHeaderTest.kt index 180221af91..c042a59aed 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetHeaderTest.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/ObjectSetHeaderTest.kt @@ -7,7 +7,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.LargeTest import com.anytypeio.anytype.R import com.anytypeio.anytype.core_models.Block -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent import com.anytypeio.anytype.test_utils.MockDataFactory @@ -69,7 +68,7 @@ class ObjectSetHeaderTest : TestObjectSetSetup() { val root = Block( id = ctx, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, dataview.id) ) diff --git a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/TestObjectSetSetup.kt b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/TestObjectSetSetup.kt index 7e48c41f57..e90a2bfc29 100644 --- a/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/TestObjectSetSetup.kt +++ b/app/src/androidTest/java/com/anytypeio/anytype/features/sets/dv/TestObjectSetSetup.kt @@ -8,12 +8,10 @@ import com.anytypeio.anytype.analytics.base.Analytics import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Event import com.anytypeio.anytype.core_models.Id -import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.Payload import com.anytypeio.anytype.core_models.Relation import com.anytypeio.anytype.core_models.SearchResult import com.anytypeio.anytype.core_models.SubscriptionEvent -import com.anytypeio.anytype.domain.`object`.UpdateDetail import com.anytypeio.anytype.domain.auth.repo.AuthRepository import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers import com.anytypeio.anytype.domain.base.Result @@ -30,6 +28,7 @@ import com.anytypeio.anytype.domain.event.interactor.InterceptEvents import com.anytypeio.anytype.domain.launch.GetDefaultPageType import com.anytypeio.anytype.domain.misc.UrlBuilder import com.anytypeio.anytype.domain.`object`.ConvertObjectToCollection +import com.anytypeio.anytype.domain.`object`.UpdateDetail import com.anytypeio.anytype.domain.objects.DefaultObjectStore import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations import com.anytypeio.anytype.domain.objects.ObjectStore @@ -280,8 +279,7 @@ abstract class TestObjectSetSetup { fun stubOpenObjectSetWithRecord( set: List, details: Block.Details = Block.Details(), - relations: List = emptyList(), - objectTypes: List + relations: List = emptyList() ) { repo.stub { onBlocking { openObjectSet(ctx) } doReturn Result.Success( @@ -294,7 +292,6 @@ abstract class TestObjectSetSetup { details = details, blocks = set, relations = relations, - objectTypes = objectTypes ) ) ) diff --git a/app/src/main/java/com/anytypeio/anytype/app/DefaultFeatureToggles.kt b/app/src/main/java/com/anytypeio/anytype/app/DefaultFeatureToggles.kt index 4051725cd8..95f83cd153 100644 --- a/app/src/main/java/com/anytypeio/anytype/app/DefaultFeatureToggles.kt +++ b/app/src/main/java/com/anytypeio/anytype/app/DefaultFeatureToggles.kt @@ -12,20 +12,11 @@ class DefaultFeatureToggles @Inject constructor( @TogglePrefs private val prefs: SharedPreferences ) : FeatureToggles { - override val isLogFromMiddlewareLibrary = - BuildConfig.LOG_FROM_MW_LIBRARY && isDebug - - override val isLogMiddlewareInteraction = - BuildConfig.LOG_MW_INTERACTION && isDebug - - override val isLogDashboardReducer = - BuildConfig.LOG_DASHBOARD_REDUCER && isDebug - - override val isLogEditorViewModelEvents = - BuildConfig.LOG_EDITOR_VIEWMODEL_EVENTS && isDebug - - override val isLogEditorControlPanelMachine = - BuildConfig.LOG_EDITOR_CONTROL_PANEL && isDebug + override val isLogFromMiddlewareLibrary = BuildConfig.LOG_FROM_MW_LIBRARY && isDebug + override val isLogMiddlewareInteraction = BuildConfig.LOG_DASHBOARD_REDUCER && isDebug + override val isLogDashboardReducer = BuildConfig.LOG_DASHBOARD_REDUCER && isDebug + override val isLogEditorViewModelEvents = BuildConfig.LOG_EDITOR_VIEWMODEL_EVENTS && isDebug + override val isLogEditorControlPanelMachine = BuildConfig.LOG_EDITOR_CONTROL_PANEL && isDebug override val isTroubleshootingMode get() = prefs.getBoolean(context.getString(R.string.trouble_mode), BuildConfig.DEBUG) diff --git a/core-models/src/main/java/com/anytypeio/anytype/core_models/Block.kt b/core-models/src/main/java/com/anytypeio/anytype/core_models/Block.kt index 5cce91e408..bc7506aff8 100644 --- a/core-models/src/main/java/com/anytypeio/anytype/core_models/Block.kt +++ b/core-models/src/main/java/com/anytypeio/anytype/core_models/Block.kt @@ -88,7 +88,7 @@ data class Block( /** * Smart block. */ - data class Smart(val type: SmartBlockType = SmartBlockType.PAGE) : Content() + object Smart : Content() /** * Textual block. diff --git a/core-models/src/main/java/com/anytypeio/anytype/core_models/Event.kt b/core-models/src/main/java/com/anytypeio/anytype/core_models/Event.kt index 2eb0cceefd..d26f71f15e 100644 --- a/core-models/src/main/java/com/anytypeio/anytype/core_models/Event.kt +++ b/core-models/src/main/java/com/anytypeio/anytype/core_models/Event.kt @@ -23,8 +23,6 @@ sealed class Event { val root: Id, val details: Block.Details = Block.Details(emptyMap()), val blocks: List, - val type: SmartBlockType = SmartBlockType.PAGE, - val objectTypes: List = emptyList(), val relations: List = emptyList(), val relationLinks: List = emptyList(), val objectRestrictions: List = emptyList(), diff --git a/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectType.kt b/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectType.kt index f790f3c9d9..21c91c81a9 100644 --- a/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectType.kt +++ b/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectType.kt @@ -27,9 +27,7 @@ data class ObjectType( @Deprecated("Will be deprecated. Object type will be treated as object") val isArchived: Boolean, @Deprecated("Will be deprecated. Object type will be treated as object") - val isReadOnly: Boolean, - @Deprecated("Will be deprecated. Object type will be treated as object") - val smartBlockTypes: List + val isReadOnly: Boolean ) { enum class Layout(val code: Int) { BASIC(0), diff --git a/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectView.kt b/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectView.kt index 61f0ea3316..dc2c457a7b 100644 --- a/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectView.kt +++ b/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectView.kt @@ -7,7 +7,6 @@ data class ObjectView( val root: Id, val blocks: List, val details: Map, - val type: SmartBlockType, val relations: List, val objectRestrictions: List, val dataViewRestrictions: List diff --git a/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectWrapper.kt b/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectWrapper.kt index bd5275e76c..1be45648fc 100644 --- a/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectWrapper.kt +++ b/core-models/src/main/java/com/anytypeio/anytype/core_models/ObjectWrapper.kt @@ -150,16 +150,6 @@ sealed class ObjectWrapper { val isArchived: Boolean? by default val iconEmoji: String? by default val isDeleted: Boolean? by default - val smartBlockTypes: List - get() = when (val value = map[Relations.SMARTBLOCKTYPES]) { - is Double -> buildList { - SmartBlockType.values().firstOrNull { it.code == value.toInt() } - } - is List<*> -> value.typeOf().mapNotNull { code -> - SmartBlockType.values().firstOrNull { it.code == code.toInt() } - } - else -> emptyList() - } } data class Relation(override val map: Struct) : ObjectWrapper() { diff --git a/core-models/src/main/java/com/anytypeio/anytype/core_models/PageLink.kt b/core-models/src/main/java/com/anytypeio/anytype/core_models/PageLink.kt deleted file mode 100644 index 6bd25f283f..0000000000 --- a/core-models/src/main/java/com/anytypeio/anytype/core_models/PageLink.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.anytypeio.anytype.core_models - -/** - * @property id document id - * @property fields document fields - * @property snippet text from first child block of the document - * @property hasInboundLinks does this page has inbound pages - */ -data class DocumentInfo( - val id: String, - val obj: ObjectWrapper.Basic, - val snippet: String?, - val hasInboundLinks: Boolean, - val smartBlockType: SmartBlockType -) - -data class ObjectLinks(val inbound: List, val outbound: List) - -data class ObjectInfoWithLinks( - val id: String, - val documentInfo: DocumentInfo, - val links: ObjectLinks -) \ No newline at end of file diff --git a/core-models/src/main/java/com/anytypeio/anytype/core_models/Relations.kt b/core-models/src/main/java/com/anytypeio/anytype/core_models/Relations.kt index 2898b341b9..873f0084e7 100644 --- a/core-models/src/main/java/com/anytypeio/anytype/core_models/Relations.kt +++ b/core-models/src/main/java/com/anytypeio/anytype/core_models/Relations.kt @@ -53,6 +53,8 @@ object Relations { const val FILE_EXT = "fileExt" const val FILE_MIME_TYPE = "fileMimeType" + const val RECOMMENDED_LAYOUT = "recommendedLayout" + val systemRelationKeys = listOf( "id", "name", diff --git a/core-models/src/main/java/com/anytypeio/anytype/core_models/SmartBlockType.kt b/core-models/src/main/java/com/anytypeio/anytype/core_models/SmartBlockType.kt index f10e16c6ed..377a048051 100644 --- a/core-models/src/main/java/com/anytypeio/anytype/core_models/SmartBlockType.kt +++ b/core-models/src/main/java/com/anytypeio/anytype/core_models/SmartBlockType.kt @@ -1,5 +1,6 @@ package com.anytypeio.anytype.core_models +@Deprecated("To be removed") enum class SmartBlockType(val code: Int) { ACCOUNT_OLD(code = 0), PAGE(code = 16), diff --git a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockDataRepository.kt b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockDataRepository.kt index e18fa0bba4..2c2a9dc11c 100644 --- a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockDataRepository.kt +++ b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockDataRepository.kt @@ -8,11 +8,9 @@ import com.anytypeio.anytype.core_models.DVFilter import com.anytypeio.anytype.core_models.DVSort import com.anytypeio.anytype.core_models.DVViewer import com.anytypeio.anytype.core_models.DVViewerType -import com.anytypeio.anytype.core_models.DocumentInfo import com.anytypeio.anytype.core_models.Hash import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.Key -import com.anytypeio.anytype.core_models.ObjectInfoWithLinks import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.ObjectView import com.anytypeio.anytype.core_models.ObjectWrapper @@ -249,12 +247,6 @@ class BlockDataRepository( command: Command.DownloadFile ): String = remote.downloadFile(command) - override suspend fun getObjectInfoWithLinks( - pageId: String - ): ObjectInfoWithLinks = remote.getObjectInfoWithLinks(pageId) - - override suspend fun getListPages(): List = remote.getListPages() - override suspend fun setRelationKey(command: Command.SetRelationKey): Payload = remote.setRelationKey(command) diff --git a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockDataStore.kt b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockDataStore.kt index 845a912d46..4f9830021c 100644 --- a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockDataStore.kt +++ b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockDataStore.kt @@ -8,10 +8,8 @@ import com.anytypeio.anytype.core_models.DVFilter import com.anytypeio.anytype.core_models.DVSort import com.anytypeio.anytype.core_models.DVViewer import com.anytypeio.anytype.core_models.DVViewerType -import com.anytypeio.anytype.core_models.DocumentInfo import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.Key -import com.anytypeio.anytype.core_models.ObjectInfoWithLinks import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.ObjectView import com.anytypeio.anytype.core_models.ObjectWrapper @@ -82,10 +80,6 @@ interface BlockDataStore { suspend fun uploadFile(command: Command.UploadFile): String suspend fun downloadFile(command: Command.DownloadFile): String - suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks - - suspend fun getListPages(): List - suspend fun updateDivider(command: Command.UpdateDivider): Payload suspend fun setFields(command: Command.SetFields): Payload diff --git a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockRemote.kt b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockRemote.kt index b6492a583a..26fbb35355 100644 --- a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockRemote.kt +++ b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockRemote.kt @@ -8,10 +8,8 @@ import com.anytypeio.anytype.core_models.DVFilter import com.anytypeio.anytype.core_models.DVSort import com.anytypeio.anytype.core_models.DVViewer import com.anytypeio.anytype.core_models.DVViewerType -import com.anytypeio.anytype.core_models.DocumentInfo import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.Key -import com.anytypeio.anytype.core_models.ObjectInfoWithLinks import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.ObjectView import com.anytypeio.anytype.core_models.ObjectWrapper @@ -81,10 +79,6 @@ interface BlockRemote { suspend fun uploadFile(command: Command.UploadFile): String suspend fun downloadFile(command: Command.DownloadFile): String - suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks - - suspend fun getListPages(): List - suspend fun setRelationKey(command: Command.SetRelationKey): Payload suspend fun updateDivider(command: Command.UpdateDivider): Payload diff --git a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockRemoteDataStore.kt b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockRemoteDataStore.kt index 851618abc4..60b7c92155 100644 --- a/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockRemoteDataStore.kt +++ b/data/src/main/java/com/anytypeio/anytype/data/auth/repo/block/BlockRemoteDataStore.kt @@ -8,10 +8,8 @@ import com.anytypeio.anytype.core_models.DVFilter import com.anytypeio.anytype.core_models.DVSort import com.anytypeio.anytype.core_models.DVViewer import com.anytypeio.anytype.core_models.DVViewerType -import com.anytypeio.anytype.core_models.DocumentInfo import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.Key -import com.anytypeio.anytype.core_models.ObjectInfoWithLinks import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.ObjectView import com.anytypeio.anytype.core_models.ObjectWrapper @@ -193,11 +191,6 @@ class BlockRemoteDataStore(private val remote: BlockRemote) : BlockDataStore { command: Command.DownloadFile ): String = remote.downloadFile(command) - override suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks = - remote.getObjectInfoWithLinks(pageId) - - override suspend fun getListPages(): List = remote.getListPages() - override suspend fun setRelationKey(command: Command.SetRelationKey): Payload = remote.setRelationKey(command) diff --git a/domain/src/main/java/com/anytypeio/anytype/domain/block/repo/BlockRepository.kt b/domain/src/main/java/com/anytypeio/anytype/domain/block/repo/BlockRepository.kt index d43a2f3789..bfc70251b5 100644 --- a/domain/src/main/java/com/anytypeio/anytype/domain/block/repo/BlockRepository.kt +++ b/domain/src/main/java/com/anytypeio/anytype/domain/block/repo/BlockRepository.kt @@ -8,11 +8,9 @@ import com.anytypeio.anytype.core_models.DVFilter import com.anytypeio.anytype.core_models.DVSort import com.anytypeio.anytype.core_models.DVViewer import com.anytypeio.anytype.core_models.DVViewerType -import com.anytypeio.anytype.core_models.DocumentInfo import com.anytypeio.anytype.core_models.Hash import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.Key -import com.anytypeio.anytype.core_models.ObjectInfoWithLinks import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.ObjectView import com.anytypeio.anytype.core_models.ObjectWrapper @@ -135,9 +133,6 @@ interface BlockRepository { suspend fun copy(command: Command.Copy): Response.Clipboard.Copy suspend fun paste(command: Command.Paste): Response.Clipboard.Paste - suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks - suspend fun getListPages(): List - suspend fun updateDivider(command: Command.UpdateDivider): Payload suspend fun setFields(command: Command.SetFields): Payload diff --git a/domain/src/test/java/com/anytypeio/anytype/domain/ext/BlockExtensionTest.kt b/domain/src/test/java/com/anytypeio/anytype/domain/ext/BlockExtensionTest.kt index 99b5c17e6b..b925849b3c 100644 --- a/domain/src/test/java/com/anytypeio/anytype/domain/ext/BlockExtensionTest.kt +++ b/domain/src/test/java/com/anytypeio/anytype/domain/ext/BlockExtensionTest.kt @@ -1,7 +1,6 @@ package com.anytypeio.anytype.domain.ext import com.anytypeio.anytype.core_models.Block -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.ext.asMap import com.anytypeio.anytype.core_models.ext.asRender import com.anytypeio.anytype.core_models.ext.getChildrenIdsList @@ -37,7 +36,7 @@ class BlockExtensionTest { val root = Block( id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(child.id) ) @@ -95,7 +94,7 @@ class BlockExtensionTest { val root = Block( id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(children[1].id, children[0].id, children[2].id) ) @@ -147,7 +146,7 @@ class BlockExtensionTest { val root = Block( id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(parent.id) ) @@ -204,7 +203,7 @@ class BlockExtensionTest { val root = Block( id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(parent.id) ) @@ -287,7 +286,7 @@ class BlockExtensionTest { val root = Block( id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(parent.id) ) @@ -406,7 +405,7 @@ class BlockExtensionTest { val root = Block( id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(row.id, lastBlock.id) ) @@ -485,7 +484,7 @@ class BlockExtensionTest { val block = Block( id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = emptyList() ) val range = IntRange(0, 44) @@ -931,7 +930,7 @@ class BlockExtensionTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -972,7 +971,7 @@ class BlockExtensionTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -1002,7 +1001,7 @@ class BlockExtensionTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id) ) diff --git a/middleware/src/main/java/com/anytypeio/anytype/middleware/block/BlockMiddleware.kt b/middleware/src/main/java/com/anytypeio/anytype/middleware/block/BlockMiddleware.kt index e75c1574ee..e80489e884 100644 --- a/middleware/src/main/java/com/anytypeio/anytype/middleware/block/BlockMiddleware.kt +++ b/middleware/src/main/java/com/anytypeio/anytype/middleware/block/BlockMiddleware.kt @@ -9,10 +9,8 @@ import com.anytypeio.anytype.core_models.DVFilter import com.anytypeio.anytype.core_models.DVSort import com.anytypeio.anytype.core_models.DVViewer import com.anytypeio.anytype.core_models.DVViewerType -import com.anytypeio.anytype.core_models.DocumentInfo import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.Key -import com.anytypeio.anytype.core_models.ObjectInfoWithLinks import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.ObjectView import com.anytypeio.anytype.core_models.ObjectWrapper @@ -26,7 +24,6 @@ import com.anytypeio.anytype.core_models.Url import com.anytypeio.anytype.core_models.WidgetLayout import com.anytypeio.anytype.data.auth.repo.block.BlockRemote import com.anytypeio.anytype.middleware.interactor.Middleware -import com.anytypeio.anytype.middleware.mappers.toCoreModel import com.anytypeio.anytype.middleware.mappers.toMiddlewareModel class BlockMiddleware( @@ -216,14 +213,6 @@ class BlockMiddleware( command: Command.DownloadFile ): String = middleware.fileDownload(command).localPath - override suspend fun getObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks { - return middleware.navigationGetObjectInfoWithLinks(pageId).toCoreModel() - } - - override suspend fun getListPages(): List { - return middleware.navigationListObjects().map { it.toCoreModel() } - } - override suspend fun setRelationKey(command: Command.SetRelationKey): Payload { return middleware.blockRelationSetKey(command) } diff --git a/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt b/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt index 31453c8c53..00c9d7b3b1 100644 --- a/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt +++ b/middleware/src/main/java/com/anytypeio/anytype/middleware/interactor/Middleware.kt @@ -2,8 +2,6 @@ package com.anytypeio.anytype.middleware.interactor import anytype.Rpc import anytype.model.Block -import anytype.model.ObjectInfo -import anytype.model.ObjectInfoWithLinks import anytype.model.Range import com.anytypeio.anytype.core_models.AccountSetup import com.anytypeio.anytype.core_models.AccountStatus @@ -787,32 +785,6 @@ class Middleware( return response } - @Throws(Exception::class) - fun navigationGetObjectInfoWithLinks(pageId: String): ObjectInfoWithLinks { - val request = Rpc.Navigation.GetObjectInfoWithLinks.Request( - objectId = pageId - ) - if (BuildConfig.DEBUG) logRequest(request) - val response = service.navigationGetObjectInfoWithLinks(request) - if (BuildConfig.DEBUG) logResponse(response) - - val info = response.object_ - - checkNotNull(info) { "Empty result" } - - return info - } - - @Throws(Exception::class) - fun navigationListObjects(): List { - val request = Rpc.Navigation.ListObjects.Request() - if (BuildConfig.DEBUG) logRequest(request) - val response = service.navigationListObjects(request) - if (BuildConfig.DEBUG) logResponse(response) - - return response.objects - } - @Throws(Exception::class) fun objectApplyTemplate( ctx: Id, diff --git a/middleware/src/main/java/com/anytypeio/anytype/middleware/mappers/ToCoreModelMappers.kt b/middleware/src/main/java/com/anytypeio/anytype/middleware/mappers/ToCoreModelMappers.kt index 7dda6116ba..2a1ec86d6a 100644 --- a/middleware/src/main/java/com/anytypeio/anytype/middleware/mappers/ToCoreModelMappers.kt +++ b/middleware/src/main/java/com/anytypeio/anytype/middleware/mappers/ToCoreModelMappers.kt @@ -2,11 +2,31 @@ package com.anytypeio.anytype.middleware.mappers import anytype.ResponseEvent import anytype.Rpc -import anytype.model.ObjectInfo -import anytype.model.ObjectInfoWithLinks -import anytype.model.ObjectLinksInfo import anytype.model.Restrictions -import com.anytypeio.anytype.core_models.* +import com.anytypeio.anytype.core_models.AccountStatus +import com.anytypeio.anytype.core_models.Block +import com.anytypeio.anytype.core_models.CreateBlockLinkWithObjectResult +import com.anytypeio.anytype.core_models.CreateObjectResult +import com.anytypeio.anytype.core_models.DVDateFormat +import com.anytypeio.anytype.core_models.DVFilter +import com.anytypeio.anytype.core_models.DVFilterCondition +import com.anytypeio.anytype.core_models.DVFilterOperator +import com.anytypeio.anytype.core_models.DVFilterQuickOption +import com.anytypeio.anytype.core_models.DVSort +import com.anytypeio.anytype.core_models.DVSortType +import com.anytypeio.anytype.core_models.DVTimeFormat +import com.anytypeio.anytype.core_models.DVViewer +import com.anytypeio.anytype.core_models.DVViewerCardSize +import com.anytypeio.anytype.core_models.DVViewerRelation +import com.anytypeio.anytype.core_models.DVViewerType +import com.anytypeio.anytype.core_models.Event +import com.anytypeio.anytype.core_models.ObjectOrder +import com.anytypeio.anytype.core_models.ObjectType +import com.anytypeio.anytype.core_models.ObjectView +import com.anytypeio.anytype.core_models.Payload +import com.anytypeio.anytype.core_models.Relation +import com.anytypeio.anytype.core_models.RelationFormat +import com.anytypeio.anytype.core_models.RelationLink import com.anytypeio.anytype.core_models.restrictions.DataViewRestriction import com.anytypeio.anytype.core_models.restrictions.DataViewRestrictions import com.anytypeio.anytype.core_models.restrictions.ObjectRestriction @@ -24,22 +44,18 @@ fun ResponseEvent?.toPayload(): Payload { } fun MObjectView.toPayload(): Payload { - val type = type.toCoreModel() return Payload( context = rootId, events = listOf( Event.Command.ShowObject( context = rootId, root = rootId, - blocks = blocks.toCoreModels( - types = mapOf(rootId to type) - ), + blocks = blocks.toCoreModels(), details = Block.Details( details.associate { details -> details.id to details.details.toCoreModel() } ), - type = type, relationLinks = relationLinks.map { it.toCoreModels() }, objectRestrictions = restrictions?.object_?.map { it.toCoreModel() }.orEmpty(), dataViewRestrictions = restrictions?.dataview?.map { it.toCoreModel() }.orEmpty() @@ -49,23 +65,19 @@ fun MObjectView.toPayload(): Payload { } fun MObjectView.toCore(): ObjectView { - val type = type.toCoreModel() return ObjectView( root = rootId, - blocks = blocks.toCoreModels(types = mapOf(rootId to type)), + blocks = blocks.toCoreModels(), details = details.associate { d -> d.id to d.details.orEmpty() }, relations = relationLinks.map { it.toCoreModels() }, objectRestrictions = restrictions?.object_?.map { it.toCoreModel() }.orEmpty(), dataViewRestrictions = restrictions?.dataview?.map { it.toCoreModel() }.orEmpty(), - type = type ) } // ---------------------- BLOCKS ------------------------ -fun List.toCoreModels( - types: Map = emptyMap() -): List = mapNotNull { block -> +fun List.toCoreModels(): List = mapNotNull { block -> when { block.text != null -> { Block( @@ -133,9 +145,7 @@ fun List.toCoreModels( id = block.id, fields = block.toCoreModelsFields(), children = block.childrenIds, - content = Block.Content.Smart( - type = types[block.id] ?: throw IllegalStateException("Type missing") - ) + content = Block.Content.Smart ) } block.dataview != null -> { @@ -595,19 +605,6 @@ fun MRelation.toCoreModels(): Relation = Relation( format = format.format() ) -fun MObjectType.toCoreModels(): ObjectType = ObjectType( - url = url, - name = name, - emoji = iconEmoji, - description = description, - isHidden = hidden, - relationLinks = relationLinks.map { it.toCoreModels() }, - layout = layout.toCoreModels(), - smartBlockTypes = types.map { it.toCoreModel() }, - isArchived = isArchived, - isReadOnly = readonly -) - fun MOTypeLayout.toCoreModels(): ObjectType.Layout = when (this) { MOTypeLayout.basic -> ObjectType.Layout.BASIC MOTypeLayout.profile -> ObjectType.Layout.PROFILE @@ -662,49 +659,6 @@ fun MRelationLink.toCoreModels() = RelationLink( format = format.format() ) -// ---------------------- NAVIGATION & SEARCH ------------------------ -fun ObjectInfoWithLinks.toCoreModel(): com.anytypeio.anytype.core_models.ObjectInfoWithLinks { - val i = info - checkNotNull(i) - return ObjectInfoWithLinks( - id = id, - links = links?.toCoreModel() ?: ObjectLinks(emptyList(), emptyList()), - documentInfo = i.toCoreModel() - ) -} - -fun ObjectLinksInfo.toCoreModel(): ObjectLinks = ObjectLinks( - inbound = inbound.map { it.toCoreModel() }, - outbound = outbound.map { it.toCoreModel() } -) - -fun ObjectInfo.toCoreModel(): DocumentInfo = DocumentInfo( - id = id, - obj = ObjectWrapper.Basic(details?.toMap() ?: mapOf()), - snippet = snippet, - hasInboundLinks = hasInboundLinks, - smartBlockType = objectType.toCoreModel() -) - -fun MSmartBlockType.toCoreModel(): SmartBlockType = when (this) { - MSmartBlockType.Page -> SmartBlockType.PAGE - MSmartBlockType.ProfilePage -> SmartBlockType.PROFILE_PAGE - MSmartBlockType.Home -> SmartBlockType.HOME - MSmartBlockType.Archive -> SmartBlockType.ARCHIVE - MSmartBlockType.File -> SmartBlockType.FILE - MSmartBlockType.Template -> SmartBlockType.TEMPLATE - MSmartBlockType.BundledRelation -> SmartBlockType.BUNDLED_RELATION - MSmartBlockType.SubObject -> SmartBlockType.SUB_OBJECT - MSmartBlockType.BundledObjectType -> SmartBlockType.BUNDLED_OBJECT_TYPE - MSmartBlockType.AnytypeProfile -> SmartBlockType.ANYTYPE_PROFILE - MSmartBlockType.BundledTemplate -> SmartBlockType.BUNDLED_TEMPLATE - MSmartBlockType.Date -> SmartBlockType.DATE - MSmartBlockType.Workspace -> SmartBlockType.WORKSPACE - MSmartBlockType.AccountOld -> SmartBlockType.ACCOUNT_OLD - MSmartBlockType.Widget -> SmartBlockType.WIDGET - MSmartBlockType.MissingObject -> SmartBlockType.MISSING_OBJECT -} - // ---------------------- RESTRICTIONS ------------------------ fun MObjectRestriction.toCoreModel(): ObjectRestriction = when (this) { MObjectRestriction.Delete -> ObjectRestriction.DELETE diff --git a/middleware/src/test/java/com/anytypeio/anytype/middleware/mappers/ToCoreModelMappersTest.kt b/middleware/src/test/java/com/anytypeio/anytype/middleware/mappers/ToCoreModelMappersTest.kt index 12e3ddbae6..e60c64417d 100644 --- a/middleware/src/test/java/com/anytypeio/anytype/middleware/mappers/ToCoreModelMappersTest.kt +++ b/middleware/src/test/java/com/anytypeio/anytype/middleware/mappers/ToCoreModelMappersTest.kt @@ -1,20 +1,10 @@ package com.anytypeio.anytype.middleware.mappers -import org.junit.Test import kotlin.test.assertEquals +import org.junit.Test class ToCoreModelMappersTest { - @Test - fun `should convert middleware smart block types models to core models`() { - MSmartBlockType.values().forEach { mwModel -> - val coreModel = mwModel.toCoreModel() - assertEquals( - expected = coreModel.code, actual = mwModel.value - ) - } - } - @Test fun `should convert middleware relation type models to core models`() { MRelationFormat.values().forEach { mwModel -> diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/Editor.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/Editor.kt index 98d3f65546..84a9457056 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/Editor.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/Editor.kt @@ -103,7 +103,6 @@ interface Editor { @Deprecated("legacy") val relations: Store.Relations = Store.Relations() - val objectTypes: Store.ObjectTypes = Store.ObjectTypes() val textSelection: Store = Store.TextSelection() val objectRestrictions: Store.ObjectRestrictions = Store.ObjectRestrictions() val relationLinks: Store.RelationLinks = Store.RelationLinks() diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt index e0a8d022bd..1027a1ab2c 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/EditorViewModel.kt @@ -26,7 +26,6 @@ import com.anytypeio.anytype.core_models.Position import com.anytypeio.anytype.core_models.Relation import com.anytypeio.anytype.core_models.RelationFormat import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.SyncStatus import com.anytypeio.anytype.core_models.TextBlock import com.anytypeio.anytype.core_models.ThemeColor @@ -521,7 +520,6 @@ class EditorViewModel( when (event) { is Event.Command.ShowObject -> { orchestrator.stores.details.update(event.details) - orchestrator.stores.objectTypes.update(event.objectTypes) orchestrator.stores.relationLinks.update(event.relationLinks) orchestrator.stores.objectRestrictions.update(event.objectRestrictions) @@ -969,11 +967,9 @@ class EditorViewModel( session.value = Session.OPEN onStartFocusing(result.data) orchestrator.proxies.payloads.send(result.data) - // Temporarily hiding sync status for file objects. - // TODO Remove when sync status for files is ready. result.data.events.forEach { event -> if (event is Event.Command.ShowObject) { - if (event.type == SmartBlockType.FILE) { + if (event.details.details[context]?.type?.contains(ObjectTypeIds.FILE) == true) { isSyncStatusVisible.value = false } val block = event.blocks.firstOrNull { it.id == context } @@ -1459,50 +1455,17 @@ class EditorViewModel( sendToast("Your object is not initialized. Please, try again later.") return } - blocks.find { it.id == context }?.let { root -> - val content = root.content - check(content is Content.Smart) - when (content.type) { - SmartBlockType.PROFILE_PAGE -> { - val details = orchestrator.stores.details.current().details - dispatch( - command = Command.OpenProfileMenu( - isFavorite = details[context]?.isFavorite ?: false, - isLocked = mode == EditorMode.Locked - ) - ) - } - SmartBlockType.PAGE -> { - val details = orchestrator.stores.details.current().details - controlPanelInteractor.onEvent(ControlPanelMachine.Event.OnDocumentMenuClicked) - dispatch( - command = Command.OpenDocumentMenu( - isArchived = details[context]?.isArchived ?: false, - isFavorite = details[context]?.isFavorite ?: false, - isLocked = mode == EditorMode.Locked, - fromName = ObjectWrapper.Basic(details[context]?.map ?: emptyMap()) - .getProperObjectName() ?: "" - ) - ) - } - SmartBlockType.FILE -> { - val details = orchestrator.stores.details.current().details - controlPanelInteractor.onEvent(ControlPanelMachine.Event.OnDocumentMenuClicked) - dispatch( - command = Command.OpenDocumentMenu( - isArchived = details[context]?.isArchived ?: false, - isFavorite = details[context]?.isFavorite ?: false, - isLocked = mode == EditorMode.Locked, - fromName = ObjectWrapper.Basic(details[context]?.map ?: emptyMap()) - .getProperObjectName() ?: "" - ) - ) - } - else -> { - Timber.e("Trying to open menu for unexpected smart content: ${content.type}") - } - } - } + controlPanelInteractor.onEvent(ControlPanelMachine.Event.OnDocumentMenuClicked) + val details = orchestrator.stores.details.current().details + val wrapper = ObjectWrapper.Basic(details[context]?.map.orEmpty()) + dispatch( + command = Command.OpenDocumentMenu( + isArchived = details[context]?.isArchived ?: false, + isFavorite = details[context]?.isFavorite ?: false, + isLocked = mode == EditorMode.Locked, + fromName = wrapper.getProperObjectName().orEmpty() + ) + ) } fun onEmptyBlockBackspaceClicked(id: String) { diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/render/DefaultBlockViewRenderer.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/render/DefaultBlockViewRenderer.kt index 73789a428d..2de5ce9da7 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/render/DefaultBlockViewRenderer.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/editor/render/DefaultBlockViewRenderer.kt @@ -9,7 +9,6 @@ import com.anytypeio.anytype.core_models.ObjectTypeIds.BOOKMARK import com.anytypeio.anytype.core_models.ObjectWrapper import com.anytypeio.anytype.core_models.RelationLink import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.core_models.ext.parseThemeTextColor import com.anytypeio.anytype.core_models.ext.textColor @@ -71,20 +70,6 @@ class DefaultBlockViewRenderer @Inject constructor( val result = mutableListOf() - if (anchor == root.id) { - root.content.let { cnt -> - if (cnt is Content.Smart && cnt.type == SmartBlockType.ARCHIVE) { - result.add( - BlockView.Title.Archive( - mode = BlockView.Mode.READ, - id = anchor, - text = details.details[root.id]?.name.orEmpty() - ) - ) - } - } - } - var mCounter = count var isPreviousBlockMedia = false @@ -1473,17 +1458,9 @@ class DefaultBlockViewRenderer @Inject constructor( val layoutCode = details.details[root.id]?.layout?.toInt() - var layout = ObjectType.Layout.values().find { it.code == layoutCode } - - if (layout == null) { - // Retrieving layout based on smart block type: - layout = if (rootContent.type == SmartBlockType.PROFILE_PAGE) - ObjectType.Layout.PROFILE - else { - // Falling back to default layout if layout is not defined - ObjectType.Layout.BASIC - } - } + val layout = ObjectType.Layout.values().find { + it.code == layoutCode + } ?: ObjectType.Layout.BASIC val blockMode = if (restrictions.contains(ObjectRestriction.DETAILS)) { BlockView.Mode.READ diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/mapper/MapperExtension.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/mapper/MapperExtension.kt index af50c7f673..e1c6128c9b 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/mapper/MapperExtension.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/mapper/MapperExtension.kt @@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.mapper import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.DVFilterCondition import com.anytypeio.anytype.core_models.DVFilterOperator -import com.anytypeio.anytype.core_models.DocumentInfo import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.ObjectWrapper @@ -18,8 +17,6 @@ import com.anytypeio.anytype.presentation.editor.editor.mention.createMentionMar import com.anytypeio.anytype.presentation.editor.editor.model.Alignment import com.anytypeio.anytype.presentation.editor.editor.model.BlockView import com.anytypeio.anytype.presentation.editor.editor.model.UiBlock -import com.anytypeio.anytype.presentation.navigation.ObjectView -import com.anytypeio.anytype.presentation.objects.ObjectIcon import com.anytypeio.anytype.presentation.objects.ObjectLayoutView import com.anytypeio.anytype.presentation.objects.ObjectTypeView import com.anytypeio.anytype.presentation.objects.getProperName @@ -337,24 +334,6 @@ fun UiBlock.style(): Block.Content.Text.Style = when (this) { fun DebugSettings.toView(): EditorSettings = EditorSettings(customContextMenu = this.isAnytypeContextMenuEnabled) -fun DocumentInfo.toView( - urlBuilder: UrlBuilder, - objectTypes: List -): ObjectView { - val typeId = obj.type.firstOrNull() - val type = objectTypes.find { it.url == typeId } - return ObjectView( - id = id, - title = obj.name.orEmpty(), - subtitle = type?.name.orEmpty(), - icon = ObjectIcon.from( - obj = obj, - layout = obj.layout, - builder = urlBuilder - ) - ) -} - fun Block.Fields.getName(): String = this.name.let { name -> if (name.isNullOrBlank()) Relations.RELATION_NAME_EMPTY else name diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/moving/MoveToViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/moving/MoveToViewModel.kt index a37f53f1f9..dac97d6182 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/moving/MoveToViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/moving/MoveToViewModel.kt @@ -3,9 +3,11 @@ package com.anytypeio.anytype.presentation.moving import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.anytypeio.anytype.analytics.base.Analytics +import com.anytypeio.anytype.core_models.DVFilter +import com.anytypeio.anytype.core_models.DVFilterCondition import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.ObjectWrapper -import com.anytypeio.anytype.core_models.SmartBlockType +import com.anytypeio.anytype.core_models.Relations import com.anytypeio.anytype.core_utils.ui.TextInputDialogBottomBehaviorApplier import com.anytypeio.anytype.domain.base.Resultat import com.anytypeio.anytype.domain.base.fold @@ -123,9 +125,22 @@ class MoveToViewModel( viewModelScope.launch { val params = GetObjectTypes.Params( sorts = emptyList(), - filters = ObjectSearchConstants.filterObjectTypeLibrary( - workspaceId = workspaceManager.getCurrentWorkspace() - ), + filters = buildList { + addAll( + ObjectSearchConstants.filterObjectTypeLibrary( + workspaceId = workspaceManager.getCurrentWorkspace() + ) + ) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) + }, keys = ObjectSearchConstants.defaultKeysObjectType ) getObjectTypes.execute(params).fold( @@ -139,10 +154,7 @@ class MoveToViewModel( } private suspend fun getSearchObjectsParams(ctx: Id): SearchObjects.Params { - - val filteredTypes = types.value.getOrDefault(emptyList()) - .filter { objectType -> objectType.smartBlockTypes.contains(SmartBlockType.PAGE) } - .map { objectType -> objectType.id } + val filteredTypes = types.value.getOrDefault(emptyList()).map { objectType -> objectType.id } return SearchObjects.Params( limit = SEARCH_LIMIT, diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectTypeChangeViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectTypeChangeViewModel.kt index 803d107b68..8338ba3280 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectTypeChangeViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectTypeChangeViewModel.kt @@ -223,6 +223,15 @@ class ObjectTypeChangeViewModel( ) ) } + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) }, sorts = ObjectSearchConstants.defaultObjectSearchSorts(), query = query, @@ -242,6 +251,15 @@ class ObjectTypeChangeViewModel( workspaceId = workspaceManager.getCurrentWorkspace() ) ) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) }, sorts = ObjectSearchConstants.defaultObjectSearchSorts(), query = query, diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectTypeExtensions.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectTypeExtensions.kt index deb49dcd78..53fe4f4090 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectTypeExtensions.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/ObjectTypeExtensions.kt @@ -4,7 +4,6 @@ import com.anytypeio.anytype.core_models.ObjectTypeIds.BOOKMARK import com.anytypeio.anytype.core_models.ObjectTypeIds.COLLECTION import com.anytypeio.anytype.core_models.ObjectTypeIds.SET import com.anytypeio.anytype.core_models.ObjectWrapper -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.presentation.mapper.toObjectTypeView /** @@ -45,11 +44,9 @@ fun List.getObjectTypeViewsForSBPage( if (excludeTypes.contains(obj.id)) { return@forEach } - if (obj.smartBlockTypes.contains(SmartBlockType.PAGE)) { - val objTypeView = obj.toObjectTypeView(selectedTypes) - result.add(objTypeView) - return@forEach - } + val objTypeView = obj.toObjectTypeView(selectedTypes) + result.add(objTypeView) + return@forEach } return result.sortedWith(ObjectTypeViewComparator()) } \ No newline at end of file diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/SupportedLayouts.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/SupportedLayouts.kt index 502a9198b9..ab6924daf2 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/SupportedLayouts.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/objects/SupportedLayouts.kt @@ -14,6 +14,18 @@ object SupportedLayouts { ObjectType.Layout.NOTE, ObjectType.Layout.BOOKMARK ) + val editorLayouts = listOf( + ObjectType.Layout.BASIC, + ObjectType.Layout.PROFILE, + ObjectType.Layout.TODO, + ObjectType.Layout.NOTE, + ObjectType.Layout.BOOKMARK + ) + val fileLayouts = listOf( + ObjectType.Layout.FILE, + ObjectType.Layout.IMAGE, + ) + fun isSupported(layout: ObjectType.Layout?) : Boolean { return layouts.contains(layout) } diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/search/ObjectSearchConstants.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/search/ObjectSearchConstants.kt index ac41bd7a42..8d438d2101 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/search/ObjectSearchConstants.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/search/ObjectSearchConstants.kt @@ -584,7 +584,8 @@ object ObjectSearchConstants { Relations.IS_ARCHIVED, Relations.IS_DELETED, Relations.SMARTBLOCKTYPES, - Relations.SOURCE_OBJECT + Relations.SOURCE_OBJECT, + Relations.RECOMMENDED_LAYOUT ) //endregion diff --git a/presentation/src/main/java/com/anytypeio/anytype/presentation/settings/OtherSettingsViewModel.kt b/presentation/src/main/java/com/anytypeio/anytype/presentation/settings/OtherSettingsViewModel.kt index 5e3f49d8dd..29ef7b5789 100644 --- a/presentation/src/main/java/com/anytypeio/anytype/presentation/settings/OtherSettingsViewModel.kt +++ b/presentation/src/main/java/com/anytypeio/anytype/presentation/settings/OtherSettingsViewModel.kt @@ -9,7 +9,6 @@ import com.anytypeio.anytype.analytics.base.EventsPropertiesKey import com.anytypeio.anytype.analytics.event.EventAnalytics import com.anytypeio.anytype.analytics.props.Props import com.anytypeio.anytype.core_models.Id -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.domain.base.BaseUseCase import com.anytypeio.anytype.domain.base.Interactor import com.anytypeio.anytype.domain.base.fold @@ -123,10 +122,6 @@ class OtherSettingsViewModel( object Exit : Command() } - companion object { - private val DEFAULT_SETTINGS_SMART_BLOCK_TYPE = SmartBlockType.PAGE - } - class Factory( private val getDefaultPageType: GetDefaultPageType, private val setDefaultEditorType: SetDefaultEditorType, diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/MockTypicalDocumentFactory.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/MockTypicalDocumentFactory.kt index b9cf831aca..63646ea192 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/MockTypicalDocumentFactory.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/MockTypicalDocumentFactory.kt @@ -48,7 +48,7 @@ object MockTypicalDocumentFactory { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) return listOf(page, header, title, a) @@ -58,7 +58,7 @@ object MockTypicalDocumentFactory { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PROFILE_PAGE), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) return listOf(page, header, title, a) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/BlockReadModeTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/BlockReadModeTest.kt index 8e4cf9ae54..01663b4685 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/BlockReadModeTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/BlockReadModeTest.kt @@ -14,6 +14,7 @@ import com.anytypeio.anytype.presentation.editor.render.parseThemeBackgroundColo import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import kotlinx.coroutines.delay import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.flow @@ -21,7 +22,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config -import kotlin.test.assertEquals @Config(sdk = [Build.VERSION_CODES.P]) @RunWith(RobolectricTestRunner::class) @@ -54,7 +54,7 @@ class BlockReadModeTest : EditorViewModelTest() { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) + blocks.map { it.id } ) ) + listOf(header, title) + blocks diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DataViewBlockTargetObjectSetTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DataViewBlockTargetObjectSetTest.kt index 3b6c0267d7..5ce5fee538 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DataViewBlockTargetObjectSetTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DataViewBlockTargetObjectSetTest.kt @@ -60,7 +60,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() { id = root, fields = Block.Fields.empty(), children = listOf(header.id, block.id, dv.id), - content = Block.Content.Smart() + content = Block.Content.Smart ) stubOpenDocument(document = listOf(page, header, title, block, dv)) @@ -114,7 +114,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() { id = root, fields = Block.Fields.empty(), children = listOf(header.id, block.id, dv.id), - content = Block.Content.Smart() + content = Block.Content.Smart ) val objectDetails = Block.Fields( mapOf( @@ -177,7 +177,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() { id = root, fields = Block.Fields.empty(), children = listOf(header.id, block.id, dv.id), - content = Block.Content.Smart() + content = Block.Content.Smart ) val objectDetails = Block.Fields( mapOf( @@ -240,7 +240,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() { id = root, fields = Block.Fields.empty(), children = listOf(header.id, block.id, dv.id), - content = Block.Content.Smart() + content = Block.Content.Smart ) val objectDetails = Block.Fields( mapOf( @@ -303,7 +303,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() { id = root, fields = Block.Fields.empty(), children = listOf(header.id, block.id, dv.id), - content = Block.Content.Smart() + content = Block.Content.Smart ) val objectDetails = Block.Fields( mapOf( @@ -365,7 +365,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() { id = root, fields = Block.Fields.empty(), children = listOf(header.id, block.id, dv.id), - content = Block.Content.Smart() + content = Block.Content.Smart ) stubOpenDocument(document = listOf(page, header, title, block, dv)) @@ -426,7 +426,7 @@ class DataViewBlockTargetObjectSetTest : EditorPresentationTestSetup() { id = root, fields = Block.Fields.empty(), children = listOf(header.id, block.id, dv.id), - content = Block.Content.Smart() + content = Block.Content.Smart ) val events = flow> { diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DefaultBlockViewRendererTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DefaultBlockViewRendererTest.kt index aa1b5ed281..0c1cc9069c 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DefaultBlockViewRendererTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DefaultBlockViewRendererTest.kt @@ -6,7 +6,6 @@ import com.anytypeio.anytype.core_models.Block.Content.Link import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubBookmark import com.anytypeio.anytype.core_models.StubCallout import com.anytypeio.anytype.core_models.StubFile @@ -178,7 +177,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, paragraph.id, toggle.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val blocks = listOf(page, header, title, paragraph, toggle, checkbox) @@ -317,7 +316,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, paragraph.id, toggle.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val blocks = listOf(page, header, title, paragraph, toggle, checkbox) @@ -453,7 +452,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, paragraph.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val blocks = listOf(page, header, title, paragraph) @@ -544,7 +543,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, paragraph.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val blocks = listOf(page, header, title, paragraph) @@ -597,7 +596,7 @@ class DefaultBlockViewRendererTest { } @Test - fun `should add profile title when smart block is profile`() { + fun `should add profile title when layout is profile`() { val title = Block( id = MockDataFactory.randomUuid(), @@ -636,8 +635,10 @@ class DefaultBlockViewRendererTest { val pageId = MockDataFactory.randomUuid() val fields = Block.Fields( map = mapOf( - "name" to name, - "iconImage" to imageName + Relations.ID to pageId, + Relations.NAME to name, + Relations.ICON_IMAGE to imageName, + Relations.LAYOUT to ObjectType.Layout.PROFILE.code.toDouble() ) ) val details = mapOf(pageId to fields) @@ -646,7 +647,7 @@ class DefaultBlockViewRendererTest { id = pageId, children = listOf(header.id, paragraph.id), fields = fields, - content = Block.Content.Smart(SmartBlockType.PROFILE_PAGE) + content = Block.Content.Smart ) val blocks = listOf(page, header, title, paragraph) @@ -699,7 +700,7 @@ class DefaultBlockViewRendererTest { } @Test - fun `should add title when smart block is page`() { + fun `should fallback to basic title when layout is not defined`() { val title = Block( id = MockDataFactory.randomUuid(), @@ -748,7 +749,7 @@ class DefaultBlockViewRendererTest { id = pageId, children = listOf(header.id, paragraph.id), fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val blocks = listOf(page, header, title, paragraph) @@ -865,7 +866,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to fields) @@ -1032,7 +1033,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to fields) @@ -1196,7 +1197,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to fields) @@ -1324,7 +1325,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id), fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to fields) @@ -1392,7 +1393,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id), fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to fields) @@ -1505,7 +1506,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random() @@ -1694,7 +1695,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random() @@ -1883,7 +1884,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random() @@ -2069,7 +2070,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random() @@ -2242,7 +2243,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random() @@ -2379,7 +2380,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val fieldsUpdated1 = Block.Fields(mapOf(Relations.NAME to mentionText2)) @@ -2520,7 +2521,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val randomEmoji1 = DefaultDocumentEmojiIconProvider.DOCUMENT_SET.random() @@ -2654,7 +2655,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val blocks = listOf(page, header, title, a) @@ -2805,7 +2806,7 @@ class DefaultBlockViewRendererTest { id = MockDataFactory.randomUuid(), children = listOf(header.id, a.id), fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to fields) @@ -3043,7 +3044,7 @@ class DefaultBlockViewRendererTest { id = "objectId", children = listOf(header.id, a1.id, a2.id, a3.id, a4.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to Block.Fields.empty()) @@ -3308,7 +3309,7 @@ class DefaultBlockViewRendererTest { id = "objectId", children = listOf(header.id, a1.id, a2.id, a3.id, a4.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to Block.Fields.empty()) @@ -3525,7 +3526,7 @@ class DefaultBlockViewRendererTest { id = "root", children = listOf(header.id) + listOf(div1.id, div2.id, div3.id, div4.id), fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to fields) @@ -3664,7 +3665,7 @@ class DefaultBlockViewRendererTest { div4.id ) + numbered.subList(20, 25).map { it.id }, fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to fields) @@ -3854,7 +3855,7 @@ class DefaultBlockViewRendererTest { div2.id ) + listOf(afterDiv2Num1.id, afterDiv2Num2.id), fields = fields, - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to fields) @@ -4164,7 +4165,7 @@ class DefaultBlockViewRendererTest { id = "objectId", children = listOf(header.id, a1.id, a2.id, a3.id, a4.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to Block.Fields.empty()) @@ -4436,7 +4437,7 @@ class DefaultBlockViewRendererTest { id = "objectId", children = listOf(quote.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to Block.Fields.empty()) @@ -4543,7 +4544,7 @@ class DefaultBlockViewRendererTest { id = "objectId", children = listOf(quote1.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to Block.Fields.empty()) @@ -4666,7 +4667,7 @@ class DefaultBlockViewRendererTest { id = "objectId", children = listOf(quote1.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to Block.Fields.empty()) @@ -4828,7 +4829,7 @@ class DefaultBlockViewRendererTest { id = "objectId", children = listOf(quote1.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to Block.Fields.empty()) @@ -5016,7 +5017,7 @@ class DefaultBlockViewRendererTest { id = "objectId", children = listOf(paragraph.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val details = mapOf(page.id to Block.Fields.empty()) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DocumentExternalEventReducerTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DocumentExternalEventReducerTest.kt index e48fd46c5c..d73861fe5b 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DocumentExternalEventReducerTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/DocumentExternalEventReducerTest.kt @@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Block.Content.Link.IconSize import com.anytypeio.anytype.core_models.Event -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubBookmark import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubLinkContent @@ -39,7 +38,7 @@ class DocumentExternalEventReducerTest { id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), children = listOf(title.id, bookmark.id), - content = Block.Content.Smart(type = SmartBlockType.PAGE) + content = Block.Content.Smart ) val state = listOf(page, title, bookmark) @@ -169,7 +168,7 @@ class DocumentExternalEventReducerTest { id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), children = listOf(title.id, bookmark.id), - content = Block.Content.Smart(type = SmartBlockType.PAGE) + content = Block.Content.Smart ) val state = listOf(page, title, bookmark) @@ -214,7 +213,7 @@ class DocumentExternalEventReducerTest { id = MockDataFactory.randomUuid(), fields = Block.Fields.empty(), children = listOf(title.id, link.id), - content = Block.Content.Smart(type = SmartBlockType.PAGE) + content = Block.Content.Smart ) val state = listOf(page, title, link) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/EditorViewModelTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/EditorViewModelTest.kt index 5f6b107654..4dd54a1a78 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/EditorViewModelTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/EditorViewModelTest.kt @@ -11,7 +11,6 @@ import com.anytypeio.anytype.core_models.Id import com.anytypeio.anytype.core_models.Payload import com.anytypeio.anytype.core_models.Position import com.anytypeio.anytype.core_models.Relation -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubFile import com.anytypeio.anytype.core_models.StubNumbered import com.anytypeio.anytype.core_models.StubParagraph @@ -418,7 +417,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -622,7 +621,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -722,7 +721,7 @@ open class EditorViewModelTest { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ) @@ -775,7 +774,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -888,7 +887,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ) @@ -1050,7 +1049,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ) @@ -1204,7 +1203,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ) @@ -1284,7 +1283,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ) @@ -1387,7 +1386,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ) @@ -1477,7 +1476,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(child) ) @@ -1589,7 +1588,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ) @@ -1791,7 +1790,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child.id) ) @@ -1860,7 +1859,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, firstChild.id, secondChild.id) ) @@ -1999,7 +1998,7 @@ open class EditorViewModelTest { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child.id) ) @@ -2104,7 +2103,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -2231,7 +2230,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -2374,7 +2373,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ), header, @@ -2476,7 +2475,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ), header, @@ -2577,7 +2576,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(title.id, file.id) ), title, @@ -2634,7 +2633,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(title.id, file.id) ), title, @@ -2695,7 +2694,7 @@ open class EditorViewModelTest { fields = Block.Fields( map = mapOf("icon" to "") ), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(title.id, paragraph.id) ), title, @@ -2760,7 +2759,7 @@ open class EditorViewModelTest { fields = Block.Fields( map = mapOf("icon" to "") ), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(title.id, paragraph.id) ), title, @@ -2825,7 +2824,7 @@ open class EditorViewModelTest { fields = Block.Fields( map = mapOf("icon" to "") ), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(title.id) ), title @@ -2879,7 +2878,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(title.id, paragraph.id) ), title, @@ -2949,7 +2948,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(title.id, numbered.id) ), title, @@ -3022,7 +3021,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(title.id, paragraph.id) ), title, @@ -3083,7 +3082,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(paragraph.id) ), paragraph @@ -3179,7 +3178,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) + paragraphs.map { it.id } ) ) + listOf(header, title) + paragraphs @@ -3362,7 +3361,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) + paragraphs.map { it.id } ) ) + listOf(header, title) + paragraphs @@ -3471,7 +3470,7 @@ open class EditorViewModelTest { fields = Block.Fields( mapOf(Block.Fields.IS_LOCKED_KEY to false) ), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, picture.id) ), header, @@ -3550,7 +3549,7 @@ open class EditorViewModelTest { fields = Block.Fields( mapOf(Block.Fields.IS_LOCKED_KEY to false) ), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, video.id) ), header, @@ -3624,7 +3623,7 @@ open class EditorViewModelTest { fields = Block.Fields( mapOf(Block.Fields.IS_LOCKED_KEY to false) ), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, file.id) ), header, @@ -4001,7 +4000,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) + paragraphs.map { it.id } ) ) + listOf(header, title) + paragraphs @@ -4116,7 +4115,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) + paragraphs.map { it.id } ) ) + listOf(header, title) + paragraphs @@ -4235,7 +4234,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) + paragraphs.map { it.id } ) ) + listOf(header, title) + paragraphs @@ -4388,7 +4387,7 @@ open class EditorViewModelTest { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = blocks.map { it.id } ) ) + blocks diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorBackspaceDeleteTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorBackspaceDeleteTest.kt index 1a9d056125..de7a8fc83d 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorBackspaceDeleteTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorBackspaceDeleteTest.kt @@ -32,6 +32,7 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Rule @@ -40,7 +41,6 @@ import org.mockito.MockitoAnnotations import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking import org.mockito.kotlin.verifyNoInteractions -import kotlin.test.assertEquals class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { @@ -98,7 +98,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, parent.id) ) @@ -221,7 +221,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, parent.id) ) @@ -362,7 +362,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, parent.id) ) @@ -474,7 +474,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, bookmark.id, paragraph.id) ) @@ -576,7 +576,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, bookmark.id, paragraph.id) ) @@ -672,7 +672,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, checkbox.id) ) @@ -717,7 +717,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, bulleted.id) ) @@ -762,7 +762,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, numbered.id) ) @@ -807,7 +807,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, toggle.id) ) @@ -852,7 +852,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, quote.id) ) @@ -902,7 +902,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, checkbox.id) ) @@ -986,7 +986,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, bulleted.id) ) @@ -1069,7 +1069,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, quote.id) ) @@ -1152,7 +1152,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, toggle.id) ) @@ -1235,7 +1235,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, numbered.id) ) @@ -1342,7 +1342,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id), ) @@ -1417,7 +1417,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id), ) @@ -1484,7 +1484,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id), ) @@ -1567,7 +1567,7 @@ class EditorBackspaceDeleteTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id), ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorBlockActionsTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorBlockActionsTest.kt index 7ac7ded7dd..aa263b28c1 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorBlockActionsTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorBlockActionsTest.kt @@ -7,13 +7,13 @@ import com.anytypeio.anytype.presentation.MockBlockFactory import com.anytypeio.anytype.presentation.editor.editor.actions.ActionItemType import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType import com.anytypeio.anytype.presentation.util.CoroutinesTestRule +import kotlin.test.assertContains +import kotlin.test.assertFalse +import kotlin.test.assertTrue import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertContains -import kotlin.test.assertFalse -import kotlin.test.assertTrue class EditorBlockActionsTest : EditorPresentationTestSetup() { @@ -39,7 +39,7 @@ class EditorBlockActionsTest : EditorPresentationTestSetup() { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, link.id) ) @@ -79,7 +79,7 @@ class EditorBlockActionsTest : EditorPresentationTestSetup() { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, p1.id, divider.id, p2.id) ) @@ -121,7 +121,7 @@ class EditorBlockActionsTest : EditorPresentationTestSetup() { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, p1.id, divider.id, p2.id) ) @@ -170,7 +170,7 @@ class EditorBlockActionsTest : EditorPresentationTestSetup() { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, p1.id, divider.id, p2.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorCheckboxTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorCheckboxTest.kt index 80a2bc4d48..f786c9244d 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorCheckboxTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorCheckboxTest.kt @@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor.editor import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Payload -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.domain.base.Either import com.anytypeio.anytype.domain.block.interactor.UpdateCheckbox @@ -63,7 +62,7 @@ class EditorCheckboxTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(child) ), checkbox @@ -123,7 +122,7 @@ class EditorCheckboxTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(child) ), checkbox diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorCreateBlockTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorCreateBlockTest.kt index fe40e53acb..c782c6dfca 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorCreateBlockTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorCreateBlockTest.kt @@ -45,7 +45,7 @@ class EditorCreateBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorDuplicateTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorDuplicateTest.kt index 39e9ee512d..6c5a2788b9 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorDuplicateTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorDuplicateTest.kt @@ -15,13 +15,13 @@ import com.anytypeio.anytype.presentation.editor.render.parseThemeBackgroundColo import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertTrue import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertTrue class EditorDuplicateTest : EditorPresentationTestSetup() { @@ -59,7 +59,7 @@ class EditorDuplicateTest : EditorPresentationTestSetup() { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id, c.id) ) @@ -120,7 +120,7 @@ class EditorDuplicateTest : EditorPresentationTestSetup() { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id, c.id) ) @@ -312,7 +312,7 @@ class EditorDuplicateTest : EditorPresentationTestSetup() { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, c.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorEmptySpaceInteractionTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorEmptySpaceInteractionTest.kt index 5fc9732a1b..25e3917806 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorEmptySpaceInteractionTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorEmptySpaceInteractionTest.kt @@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor.editor import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Position -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubHeader import com.anytypeio.anytype.core_models.StubLinkToObjectBlock import com.anytypeio.anytype.core_models.StubSmartBlock @@ -73,7 +72,7 @@ class EditorEmptySpaceInteractionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ) @@ -126,7 +125,7 @@ class EditorEmptySpaceInteractionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -241,7 +240,7 @@ class EditorEmptySpaceInteractionTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(type = SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(pic.id, txt.id) ), pic, @@ -323,7 +322,7 @@ class EditorEmptySpaceInteractionTest : EditorPresentationTestSetup() { id = root, children = listOf(header.id) + listOf(table.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val document = listOf(page, header, title, table) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorErrorMessageTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorErrorMessageTest.kt index 409fe9b0d5..272af28231 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorErrorMessageTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorErrorMessageTest.kt @@ -2,7 +2,6 @@ package com.anytypeio.anytype.presentation.editor.editor import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.domain.base.Either import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory @@ -50,7 +49,7 @@ class EditorErrorMessageTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(file.id) ), file diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorEventSubscriptionTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorEventSubscriptionTest.kt index 4dd827c120..f7f4c56faf 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorEventSubscriptionTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorEventSubscriptionTest.kt @@ -45,7 +45,7 @@ class EditorEventSubscriptionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorFeaturedRelationsTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorFeaturedRelationsTest.kt index 5abe902469..5b336e244c 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorFeaturedRelationsTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorFeaturedRelationsTest.kt @@ -5,7 +5,6 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Relation import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubObjectType import com.anytypeio.anytype.core_models.StubRelationObject import com.anytypeio.anytype.core_models.ext.content @@ -19,6 +18,7 @@ import com.anytypeio.anytype.presentation.relations.ObjectRelationView import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import kotlinx.coroutines.test.runTest import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.After @@ -26,7 +26,6 @@ import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertEquals class EditorFeaturedRelationsTest : EditorPresentationTestSetup() { @@ -70,7 +69,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, featuredBlock.id, block.id) ) @@ -201,7 +200,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -313,7 +312,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, featuredBlock.id, block.id) ) @@ -423,7 +422,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, featuredBlock.id, block.id) ) @@ -552,7 +551,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, featuredBlock.id, block.id) ) @@ -687,7 +686,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, featuredBlock.id, block.id) ) @@ -808,7 +807,7 @@ class EditorFeaturedRelationsTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, featuredBlock.id, block.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorFocusTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorFocusTest.kt index f238aedc26..e11775e8ad 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorFocusTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorFocusTest.kt @@ -18,12 +18,12 @@ import com.anytypeio.anytype.presentation.editor.editor.model.Focusable import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations import org.mockito.kotlin.verifyNoInteractions -import kotlin.test.assertEquals class EditorFocusTest : EditorPresentationTestSetup() { @@ -80,7 +80,7 @@ class EditorFocusTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ), header, @@ -130,7 +130,7 @@ class EditorFocusTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ), header, @@ -173,7 +173,7 @@ class EditorFocusTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ), header, @@ -229,7 +229,7 @@ class EditorFocusTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ), header, @@ -301,7 +301,7 @@ class EditorFocusTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) val document = listOf(page, header, title, paragraph) @@ -343,7 +343,7 @@ class EditorFocusTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, first.id) ) val doc = listOf(page, header, title, first) @@ -395,7 +395,7 @@ class EditorFocusTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, first.id) ) val doc = listOf(page, header, title, first) @@ -453,7 +453,7 @@ class EditorFocusTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, table.id, paragraph.id) + listOf(table.id) + listOf( paragraph.id ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorGranularChangeTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorGranularChangeTest.kt index ab5cc8a276..3a4278d071 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorGranularChangeTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorGranularChangeTest.kt @@ -73,7 +73,7 @@ class EditorGranularChangeTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, checkbox.id) ), header, diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorLatexBlockTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorLatexBlockTest.kt index 73ec24cb16..e93bc27388 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorLatexBlockTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorLatexBlockTest.kt @@ -66,7 +66,7 @@ class EditorLatexBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, latex.id) ) @@ -125,7 +125,7 @@ class EditorLatexBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, p.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorListBlockTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorListBlockTest.kt index 622967b82c..c3cdfda227 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorListBlockTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorListBlockTest.kt @@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor.editor import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Event -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubTitle import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.core_models.ext.content @@ -61,7 +60,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -130,7 +129,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -199,7 +198,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -266,7 +265,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -344,7 +343,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -479,7 +478,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -633,7 +632,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, @@ -768,7 +767,7 @@ class EditorListBlockTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, child) ), header, diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorLockPageTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorLockPageTest.kt index e4d9474159..53765ba49d 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorLockPageTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorLockPageTest.kt @@ -4,7 +4,6 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubBookmark import com.anytypeio.anytype.core_models.StubTitle import com.anytypeio.anytype.core_models.ThemeColor @@ -21,11 +20,11 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertEquals class EditorLockPageTest : EditorPresentationTestSetup() { @@ -73,7 +72,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, child.id) ), header, @@ -142,7 +141,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, child.id) ), header, @@ -211,7 +210,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() { fields = Block.Fields( mapOf(Block.Fields.IS_LOCKED_KEY to true) ), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, child.id) ), header, @@ -268,7 +267,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() { fields = Block.Fields( mapOf(Block.Fields.IS_LOCKED_KEY to true) ), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, link.id) ), header, @@ -374,7 +373,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() { fields = Block.Fields( mapOf(Block.Fields.IS_LOCKED_KEY to true) ), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ), header, @@ -483,7 +482,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() { fields = Block.Fields( mapOf(Block.Fields.IS_LOCKED_KEY to true) ), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, bookmark.id) ), header, @@ -589,7 +588,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() { fields = Block.Fields( mapOf(Block.Fields.IS_LOCKED_KEY to true) ), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, file.id) ), header, @@ -682,7 +681,7 @@ class EditorLockPageTest : EditorPresentationTestSetup() { fields = Block.Fields( mapOf(Block.Fields.IS_LOCKED_KEY to true) ), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, picture.id) ), header, diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMarkupObjectTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMarkupObjectTest.kt index 0245d763a6..a0ace367cd 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMarkupObjectTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMarkupObjectTest.kt @@ -4,7 +4,6 @@ import android.util.Log import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.ObjectTypeIds.PAGE -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.presentation.BuildConfig import com.anytypeio.anytype.presentation.MockTypicalDocumentFactory @@ -15,13 +14,13 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.After import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertEquals class EditorMarkupObjectTest : EditorPresentationTestSetup() { @@ -67,7 +66,7 @@ class EditorMarkupObjectTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -218,7 +217,7 @@ class EditorMarkupObjectTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -386,7 +385,7 @@ class EditorMarkupObjectTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMentionTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMentionTest.kt index b96dbab6e1..5959e259c8 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMentionTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMentionTest.kt @@ -25,6 +25,8 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals +import kotlin.time.ExperimentalTime import kotlinx.coroutines.runBlocking import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.Before @@ -40,8 +42,6 @@ import org.mockito.kotlin.times import org.mockito.kotlin.verify import org.mockito.kotlin.verifyBlocking import org.mockito.kotlin.verifyNoInteractions -import kotlin.test.assertEquals -import kotlin.time.ExperimentalTime class EditorMentionTest : EditorPresentationTestSetup() { @@ -152,7 +152,7 @@ class EditorMentionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -302,7 +302,7 @@ class EditorMentionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -470,7 +470,7 @@ class EditorMentionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -606,7 +606,7 @@ class EditorMentionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -714,7 +714,7 @@ class EditorMentionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id) ) @@ -863,7 +863,7 @@ class EditorMentionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -1010,7 +1010,7 @@ class EditorMentionTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMenuTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMenuTest.kt index 66cd77c36e..019e42e40d 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMenuTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMenuTest.kt @@ -24,33 +24,6 @@ class EditorMenuTest : EditorPresentationTestSetup() { MockitoAnnotations.openMocks(this) } - @Test - fun `should dispatch command for opening profile menu if document is started`() { - - // SETUP - - val doc = profile(root) - - stubInterceptEvents() - stubOpenDocument(document = doc) - - val vm = buildViewModel() - - // TESTING - - vm.onStart(root) - - val observer = vm.commands.test() - - observer.assertNoValue() - - vm.onDocumentMenuClicked() - - observer.assertValue { value -> - value.peekContent() == Command.OpenProfileMenu(isFavorite = false, isLocked = false) - } - } - @Test fun `should not dispatch command for opening profile menu if document is not started`() { diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMergeTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMergeTest.kt index 32eac83fa8..b878988198 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMergeTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMergeTest.kt @@ -2,7 +2,6 @@ package com.anytypeio.anytype.presentation.editor.editor import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubHeader import com.anytypeio.anytype.core_models.StubParagraph import com.anytypeio.anytype.core_models.StubTitle @@ -47,7 +46,7 @@ class EditorMergeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, first.id, second.id) ) @@ -162,7 +161,7 @@ class EditorMergeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(div1.id, div2.id) ) @@ -269,7 +268,7 @@ class EditorMergeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(div1.id, div2.id) ) @@ -332,7 +331,7 @@ class EditorMergeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(a.id, b.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMultiSelectModeTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMultiSelectModeTest.kt index 7620f67083..d9d0d1554e 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMultiSelectModeTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorMultiSelectModeTest.kt @@ -3,19 +3,15 @@ package com.anytypeio.anytype.presentation.editor.editor import android.os.Build import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block -import com.anytypeio.anytype.core_models.StubTitle -import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.core_models.StubHeader import com.anytypeio.anytype.core_models.StubLayoutColumns import com.anytypeio.anytype.core_models.StubLayoutRows -import com.anytypeio.anytype.core_models.StubParagraph import com.anytypeio.anytype.core_models.StubTable import com.anytypeio.anytype.core_models.StubTableCells -import com.anytypeio.anytype.core_models.StubTableColumn import com.anytypeio.anytype.core_models.StubTableColumns -import com.anytypeio.anytype.core_models.StubTableRow import com.anytypeio.anytype.core_models.StubTableRows import com.anytypeio.anytype.core_models.StubTitle +import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.domain.block.interactor.UnlinkBlocks import com.anytypeio.anytype.domain.clipboard.Copy @@ -36,6 +32,7 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test @@ -45,7 +42,6 @@ import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config -import kotlin.test.assertEquals @Config(sdk = [Build.VERSION_CODES.P]) @RunWith(RobolectricTestRunner::class) @@ -156,7 +152,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, parent.id) ) @@ -435,7 +431,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, parent.id) ) @@ -672,7 +668,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, parent.id) ) @@ -759,7 +755,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -835,7 +831,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id, c.id) ) @@ -910,7 +906,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val smart = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id, c.id) ) @@ -1066,7 +1062,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id, c.id) ) @@ -1139,7 +1135,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id, c.id) ) @@ -1187,7 +1183,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id, c.id) ) @@ -1236,7 +1232,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id, c.id) ) @@ -1284,7 +1280,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id, c.id) ) @@ -1364,7 +1360,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block1.id, block2.id, block3.id) ) @@ -1415,7 +1411,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { id = root, children = listOf(header.id) + listOf(table.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val document = @@ -1453,7 +1449,7 @@ class EditorMultiSelectModeTest : EditorPresentationTestSetup() { id = root, children = listOf(header.id) + listOf(table.id), fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val document = diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorNoteLayoutTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorNoteLayoutTest.kt index dfc09c00e0..8c73b3f461 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorNoteLayoutTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorNoteLayoutTest.kt @@ -7,7 +7,6 @@ import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.RelationLink import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubObjectType import com.anytypeio.anytype.core_models.StubRelationObject import com.anytypeio.anytype.presentation.editor.EditorViewModel @@ -17,6 +16,8 @@ import com.anytypeio.anytype.presentation.relations.ObjectRelationView import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals +import kotlin.time.ExperimentalTime import kotlinx.coroutines.runBlocking import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.After @@ -24,8 +25,6 @@ import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertEquals -import kotlin.time.ExperimentalTime class EditorNoteLayoutTest : EditorPresentationTestSetup() { @@ -76,7 +75,7 @@ class EditorNoteLayoutTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id) ) @@ -193,7 +192,7 @@ class EditorNoteLayoutTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorObjectTypeChangeWidgetTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorObjectTypeChangeWidgetTest.kt index 60327358e7..3ec9142086 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorObjectTypeChangeWidgetTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorObjectTypeChangeWidgetTest.kt @@ -3,23 +3,21 @@ package com.anytypeio.anytype.presentation.editor.editor import android.util.Log import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block -import com.anytypeio.anytype.core_models.InternalFlags import com.anytypeio.anytype.core_models.ObjectType import com.anytypeio.anytype.core_models.ObjectTypeIds import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.presentation.editor.EditorViewModel import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory +import kotlin.test.assertFalse +import kotlin.test.assertNotNull +import kotlin.test.assertTrue import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.After import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertFalse -import kotlin.test.assertNotNull -import kotlin.test.assertTrue class EditorObjectTypeChangeWidgetTest : EditorPresentationTestSetup() { @@ -80,7 +78,7 @@ class EditorObjectTypeChangeWidgetTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -151,7 +149,7 @@ class EditorObjectTypeChangeWidgetTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorQuickStartingScrollAndMoveTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorQuickStartingScrollAndMoveTest.kt index bf395d7419..f5cdbff6b8 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorQuickStartingScrollAndMoveTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorQuickStartingScrollAndMoveTest.kt @@ -13,11 +13,11 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertEquals class EditorQuickStartingScrollAndMoveTest : EditorPresentationTestSetup() { @@ -82,7 +82,7 @@ class EditorQuickStartingScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id) ) @@ -205,7 +205,7 @@ class EditorQuickStartingScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorRelationBlockTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorRelationBlockTest.kt index 1eb8579f7b..b5842ba008 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorRelationBlockTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorRelationBlockTest.kt @@ -4,7 +4,6 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Relation import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubRelationObject import com.anytypeio.anytype.core_models.StubTitle import com.anytypeio.anytype.core_models.ext.content @@ -17,12 +16,12 @@ import com.anytypeio.anytype.presentation.relations.ObjectRelationView import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory +import kotlin.test.assertEquals import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertEquals class EditorRelationBlockTest : EditorPresentationTestSetup() { @@ -84,7 +83,7 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id) ) @@ -175,7 +174,7 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, block.id, relationBlock.id) ) @@ -316,7 +315,7 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, block.id, relationBlock.id) ) @@ -437,7 +436,7 @@ class EditorRelationBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, block.id, relationBlock.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorScrollAndMoveTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorScrollAndMoveTest.kt index bbc72a6773..f0bf5cf563 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorScrollAndMoveTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorScrollAndMoveTest.kt @@ -101,7 +101,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id, c.id) ) @@ -178,7 +178,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id, c.id) ) @@ -234,7 +234,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -340,7 +340,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id, c.id) ) @@ -409,7 +409,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id) ) @@ -480,7 +480,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id) ) @@ -542,7 +542,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id) ) @@ -615,7 +615,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, parent.id) ) @@ -710,7 +710,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(parent.id, block.id) ) @@ -839,7 +839,7 @@ class EditorScrollAndMoveTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(a.id, b.id, c.id, d.id, e.id, f.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetActionsTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetActionsTest.kt index de35f817be..e93d05b7fa 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetActionsTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetActionsTest.kt @@ -15,6 +15,9 @@ import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNotNull import org.junit.After import org.junit.Before import org.junit.Rule @@ -23,9 +26,6 @@ import org.mockito.MockitoAnnotations import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking import org.mockito.kotlin.verifyNoMoreInteractions -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertNotNull class EditorSlashWidgetActionsTest : EditorPresentationTestSetup() { @@ -594,7 +594,7 @@ class EditorSlashWidgetActionsTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetClicksTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetClicksTest.kt index 63fbc07e07..4f71186df4 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetClicksTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetClicksTest.kt @@ -17,13 +17,13 @@ import com.anytypeio.anytype.presentation.objects.ObjectTypeView import com.anytypeio.anytype.presentation.relations.ObjectRelationView import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory +import kotlin.test.assertEquals +import kotlin.test.assertNotNull import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertEquals -import kotlin.test.assertNotNull class EditorSlashWidgetClicksTest: EditorPresentationTestSetup() { @@ -278,7 +278,7 @@ class EditorSlashWidgetClicksTest: EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -442,7 +442,7 @@ class EditorSlashWidgetClicksTest: EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id, b.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetColorTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetColorTest.kt index 0a7096ccee..8fe76b9fcf 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetColorTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetColorTest.kt @@ -15,6 +15,9 @@ import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem import com.anytypeio.anytype.presentation.editor.editor.slash.SlashWidgetState import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNotNull import org.junit.After import org.junit.Before import org.junit.Rule @@ -25,9 +28,6 @@ import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertNotNull @Config(sdk = [Build.VERSION_CODES.P]) @RunWith(RobolectricTestRunner::class) @@ -73,7 +73,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -158,7 +158,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -243,7 +243,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -453,7 +453,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -540,7 +540,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -627,7 +627,7 @@ class EditorSlashWidgetColorTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetCutFilterTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetCutFilterTest.kt index 56a0fc75cf..cf168e6f57 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetCutFilterTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetCutFilterTest.kt @@ -138,7 +138,7 @@ class EditorSlashWidgetCutFilterTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetMarksTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetMarksTest.kt index 7a6d067e24..8c5132b5fa 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetMarksTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetMarksTest.kt @@ -13,6 +13,9 @@ import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNotNull import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.After import org.junit.Before @@ -21,9 +24,6 @@ import org.junit.Test import org.mockito.MockitoAnnotations import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertNotNull class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { @@ -131,7 +131,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -283,7 +283,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id, block3.id) ) @@ -380,7 +380,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id, block3.id) ) @@ -540,7 +540,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id, block3.id) ) @@ -621,7 +621,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id) ) @@ -773,7 +773,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id, block3.id) ) @@ -854,7 +854,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id) ) @@ -1012,7 +1012,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id, block3.id) ) @@ -1093,7 +1093,7 @@ class EditorSlashWidgetMarksTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetRelationsTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetRelationsTest.kt index e8bda850a7..15a1216b60 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetRelationsTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetRelationsTest.kt @@ -21,6 +21,7 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import kotlinx.coroutines.test.runTest import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.After @@ -30,7 +31,6 @@ import org.junit.Test import org.mockito.MockitoAnnotations import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertEquals class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() { @@ -164,7 +164,7 @@ class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) @@ -280,7 +280,7 @@ class EditorSlashWidgetRelationsTest: EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, a.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetStyleTypeTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetStyleTypeTest.kt index 9fb4b6ba73..9690e68b5c 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetStyleTypeTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSlashWidgetStyleTypeTest.kt @@ -11,6 +11,9 @@ import com.anytypeio.anytype.presentation.editor.editor.slash.SlashEvent import com.anytypeio.anytype.presentation.editor.editor.slash.SlashItem import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNotNull import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.After import org.junit.Before @@ -19,9 +22,6 @@ import org.junit.Test import org.mockito.MockitoAnnotations import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertNotNull class EditorSlashWidgetStyleTypeTest : EditorPresentationTestSetup() { @@ -79,7 +79,7 @@ class EditorSlashWidgetStyleTypeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id) ) @@ -213,7 +213,7 @@ class EditorSlashWidgetStyleTypeTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id, block2.id, block3.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSplitTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSplitTest.kt index d7bd5a6fdd..ab946096ac 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSplitTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorSplitTest.kt @@ -14,6 +14,7 @@ import com.anytypeio.anytype.domain.block.interactor.UpdateText import com.anytypeio.anytype.presentation.editor.EditorViewModel import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory +import kotlin.test.assertEquals import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.After import org.junit.Before @@ -24,7 +25,6 @@ import org.mockito.kotlin.eq import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking import org.mockito.kotlin.verifyNoInteractions -import kotlin.test.assertEquals class EditorSplitTest : EditorPresentationTestSetup() { @@ -176,7 +176,7 @@ class EditorSplitTest : EditorPresentationTestSetup() { fun createPage(root: Id, children: List) = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = children ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorStartupTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorStartupTest.kt index 6273ce44e9..ce35417a02 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorStartupTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorStartupTest.kt @@ -31,7 +31,7 @@ class EditorStartupTest : EditorPresentationTestSetup() { Block( id = "some id", fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = emptyList() ) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTableOfContentsBlockTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTableOfContentsBlockTest.kt index 4054772c45..1746a8b900 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTableOfContentsBlockTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTableOfContentsBlockTest.kt @@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation.editor.editor import android.util.Log import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.presentation.BuildConfig import com.anytypeio.anytype.presentation.MockTypicalDocumentFactory @@ -14,13 +13,13 @@ import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.presentation.util.TXT import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.After import org.junit.Before import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import kotlin.test.assertEquals class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() { @@ -184,7 +183,7 @@ class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf( header.id, blockToC.id, @@ -520,7 +519,7 @@ class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf( header.id, blockToC.id, @@ -879,7 +878,7 @@ class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf( header.id, blockToC.id, @@ -1127,7 +1126,7 @@ class EditorTableOfContentsBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf( header.id, div1.id, diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTextUpdateTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTextUpdateTest.kt index 3353ba5863..3ba02071f6 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTextUpdateTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTextUpdateTest.kt @@ -4,7 +4,6 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.domain.block.interactor.UpdateText -import com.anytypeio.anytype.domain.page.CloseBlock import com.anytypeio.anytype.presentation.editor.EditorViewModel import com.anytypeio.anytype.presentation.editor.editor.model.BlockView import com.anytypeio.anytype.presentation.util.CoroutinesTestRule @@ -72,7 +71,7 @@ class EditorTextUpdateTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -144,7 +143,7 @@ class EditorTextUpdateTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -217,7 +216,7 @@ class EditorTextUpdateTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -291,7 +290,7 @@ class EditorTextUpdateTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTitleAddBlockTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTitleAddBlockTest.kt index ee4408dc5a..9ed9be5b8a 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTitleAddBlockTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTitleAddBlockTest.kt @@ -59,7 +59,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ) @@ -114,7 +114,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -158,7 +158,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ) @@ -217,7 +217,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -265,7 +265,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ) @@ -317,7 +317,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -358,7 +358,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ) @@ -410,7 +410,7 @@ class EditorTitleAddBlockTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTitleTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTitleTest.kt index a77a747192..4f9260df10 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTitleTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTitleTest.kt @@ -16,6 +16,7 @@ import com.anytypeio.anytype.presentation.editor.render.parseThemeBackgroundColo import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory import com.jraska.livedata.test +import kotlin.test.assertEquals import kotlinx.coroutines.delay import kotlinx.coroutines.flow.flow import kotlinx.coroutines.launch @@ -30,7 +31,6 @@ import org.mockito.kotlin.eq import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking import org.mockito.kotlin.verifyNoMoreInteractions -import kotlin.test.assertEquals class EditorTitleTest : EditorPresentationTestSetup() { @@ -86,7 +86,7 @@ class EditorTitleTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ) @@ -136,7 +136,7 @@ class EditorTitleTest : EditorPresentationTestSetup() { Block( id = root, fields = Block.Fields.empty(), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ), header, @@ -180,7 +180,7 @@ class EditorTitleTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id) ) @@ -292,7 +292,7 @@ class EditorTitleTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) @@ -417,7 +417,7 @@ class EditorTitleTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, block.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTurnIntoTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTurnIntoTest.kt index 13e4b9fd34..8d0ce0720f 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTurnIntoTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/EditorTurnIntoTest.kt @@ -88,7 +88,7 @@ class EditorTurnIntoTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(), + content = Block.Content.Smart, children = listOf(header.id, parent.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/styling/EditorStyleBackgroundToolbarTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/styling/EditorStyleBackgroundToolbarTest.kt index 283060c3c8..d4aaf95ddd 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/styling/EditorStyleBackgroundToolbarTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/styling/EditorStyleBackgroundToolbarTest.kt @@ -3,17 +3,18 @@ package com.anytypeio.anytype.presentation.editor.editor.styling import android.os.Build import androidx.arch.core.executor.testing.InstantTaskExecutorRule import com.anytypeio.anytype.core_models.Block -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.TextStyle +import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.presentation.MockBlockFactory import com.anytypeio.anytype.presentation.editor.EditorViewModel import com.anytypeio.anytype.presentation.editor.editor.EditorPresentationTestSetup -import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.presentation.editor.editor.actions.ActionItemType import com.anytypeio.anytype.presentation.editor.editor.control.ControlPanelState import com.anytypeio.anytype.presentation.editor.editor.listener.ListenerType import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory +import kotlin.test.assertEquals +import kotlin.test.assertNotNull import org.junit.After import org.junit.Before import org.junit.Rule @@ -22,8 +23,6 @@ import org.junit.runner.RunWith import org.mockito.MockitoAnnotations import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config -import kotlin.test.assertEquals -import kotlin.test.assertNotNull @Config(sdk = [Build.VERSION_CODES.P]) @RunWith(RobolectricTestRunner::class) @@ -55,7 +54,7 @@ class EditorStyleBackgroundToolbarTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, paragraph.id) ) @@ -158,7 +157,7 @@ class EditorStyleBackgroundToolbarTest : EditorPresentationTestSetup() { val page = Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(header.id, block1.id, block2.id) ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/table/TableBlockRendererTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/table/TableBlockRendererTest.kt index 266af34f2d..3027e12a10 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/table/TableBlockRendererTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/editor/editor/table/TableBlockRendererTest.kt @@ -13,23 +13,24 @@ import com.anytypeio.anytype.core_models.StubTable import com.anytypeio.anytype.core_models.StubTableColumn import com.anytypeio.anytype.core_models.StubTableRow import com.anytypeio.anytype.core_models.StubTitle +import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.core_models.ext.asMap import com.anytypeio.anytype.core_models.ext.content import com.anytypeio.anytype.core_models.restrictions.ObjectRestriction import com.anytypeio.anytype.domain.config.Gateway import com.anytypeio.anytype.domain.editor.Editor import com.anytypeio.anytype.domain.misc.UrlBuilder -import com.anytypeio.anytype.presentation.editor.cover.CoverImageHashProvider -import com.anytypeio.anytype.core_models.ThemeColor import com.anytypeio.anytype.domain.objects.DefaultStoreOfObjectTypes import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations import com.anytypeio.anytype.presentation.BuildConfig +import com.anytypeio.anytype.presentation.editor.cover.CoverImageHashProvider import com.anytypeio.anytype.presentation.editor.editor.model.BlockView import com.anytypeio.anytype.presentation.editor.render.BlockViewRenderer import com.anytypeio.anytype.presentation.editor.render.DefaultBlockViewRenderer import com.anytypeio.anytype.presentation.editor.render.parseThemeBackgroundColor import com.anytypeio.anytype.presentation.editor.toggle.ToggleStateHolder import com.anytypeio.anytype.presentation.util.TXT +import kotlin.test.assertEquals import kotlinx.coroutines.runBlocking import net.lachlanmckee.timberjunit.TimberTestRule import org.junit.Before @@ -37,7 +38,6 @@ import org.junit.Rule import org.junit.Test import org.mockito.Mock import org.mockito.MockitoAnnotations -import kotlin.test.assertEquals class TableBlockRendererTest { @@ -151,7 +151,7 @@ class TableBlockRendererTest { id = "page", children = listOf(header.id) + blocksUpper.map { it.id } + listOf(table.id) + blocksDown.map { it.id }, fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val l = mutableListOf() @@ -329,7 +329,7 @@ class TableBlockRendererTest { id = "page", children = listOf(header.id) + blocksUpper.map { it.id } + listOf(table.id) + blocksDown.map { it.id }, fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val l = mutableListOf() @@ -519,7 +519,7 @@ class TableBlockRendererTest { id = "page", children = listOf(header.id) + blocksUpper.map { it.id } + listOf(table.id) + blocksDown.map { it.id }, fields = Block.Fields.empty(), - content = Block.Content.Smart() + content = Block.Content.Smart ) val l = mutableListOf() diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/home/HomeScreenViewModelTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/home/HomeScreenViewModelTest.kt index 34c6c9e38b..f648bee419 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/home/HomeScreenViewModelTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/home/HomeScreenViewModelTest.kt @@ -11,7 +11,6 @@ import com.anytypeio.anytype.core_models.ObjectView import com.anytypeio.anytype.core_models.ObjectWrapper import com.anytypeio.anytype.core_models.Payload import com.anytypeio.anytype.core_models.Relations -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.StubConfig import com.anytypeio.anytype.core_models.StubLinkToObjectBlock import com.anytypeio.anytype.core_models.StubObject @@ -179,12 +178,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = emptyList(), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf(smartBlock) ) @@ -255,12 +252,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = emptyList(), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf(smartBlock), details = emptyMap() ) @@ -322,12 +317,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(widgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, widgetBlock, @@ -417,12 +410,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(widgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, widgetBlock, @@ -546,12 +537,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(favoriteWidgetBlock.id, recentWidgetBlock.id, setsWidgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, favoriteWidgetBlock, @@ -737,12 +726,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(widgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, widgetBlock, @@ -821,12 +808,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(widgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, widgetBlock, @@ -940,12 +925,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(widgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, widgetBlock, @@ -1031,12 +1014,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(widgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, widgetBlock, @@ -1118,12 +1099,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(favoriteWidgetBlock.id, recentWidgetBlock.id, setsWidgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, favoriteWidgetBlock, @@ -1253,12 +1232,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(favoriteWidgetBlock.id, recentWidgetBlock.id, setsWidgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, favoriteWidgetBlock, @@ -1457,12 +1434,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(favoriteWidgetBlock.id, recentWidgetBlock.id, setsWidgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, favoriteWidgetBlock, @@ -1645,12 +1620,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(widgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, widgetBlock, @@ -1725,12 +1698,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(widgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, widgetBlock, @@ -1794,12 +1765,10 @@ class HomeScreenViewModelTest { val smartBlock = StubSmartBlock( id = WIDGET_OBJECT_ID, children = listOf(widgetBlock.id), - type = SmartBlockType.WIDGET ) val givenObjectView = StubObjectView( root = WIDGET_OBJECT_ID, - type = SmartBlockType.WIDGET, blocks = listOf( smartBlock, widgetBlock, diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/search/ObjectSearchExtensionsTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/search/ObjectSearchExtensionsTest.kt deleted file mode 100644 index 7073c8db58..0000000000 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/search/ObjectSearchExtensionsTest.kt +++ /dev/null @@ -1,87 +0,0 @@ -package com.anytypeio.anytype.presentation.search - -import com.anytypeio.anytype.presentation.MockObjectTypes -import com.anytypeio.anytype.presentation.mapper.toObjectTypeView -import com.anytypeio.anytype.presentation.objects.getObjectTypeViewsForSBPage -import org.junit.Test -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertTrue - -class ObjectSearchExtensionsTest { - - @Test - fun `should return sorted views with set and collection, without bookmark and page`() { - - val searchObjectsResponse = MockObjectTypes.objectTypeList - val excludeTypes = listOf(MockObjectTypes.objectTypePage.id) - val selectedTypes = listOf(MockObjectTypes.objectTypeNote.id) - - val expected = listOf( - MockObjectTypes.objectTypeNote, - MockObjectTypes.objectTypeCollection, - MockObjectTypes.objectTypeTask, - MockObjectTypes.objectTypeCustom, - MockObjectTypes.objectTypeHuman, - MockObjectTypes.objectTypeSet - ) - .map { it.toObjectTypeView(selectedSources = selectedTypes) } - - val actual = searchObjectsResponse.getObjectTypeViewsForSBPage( - isWithCollection = true, - isWithBookmark = false, - excludeTypes = excludeTypes, - selectedTypes = selectedTypes - ) - - assertEquals( - expected = expected, - actual = actual - ) - - actual.forEach { - if (it.id == MockObjectTypes.objectTypeNote.id) { - assertTrue { it.isSelected } - } else { - assertFalse { it.isSelected } - } - } - } - - @Test - fun `should return sorted views with bookmark, without set and note`() { - - val searchObjectsResponse = MockObjectTypes.objectTypeList - val excludeTypes = listOf(MockObjectTypes.objectTypeNote.id) - val selectedTypes = listOf(MockObjectTypes.objectTypePage.id) - - val expected = listOf( - MockObjectTypes.objectTypePage, - MockObjectTypes.objectTypeTask, - MockObjectTypes.objectTypeBookmark, - MockObjectTypes.objectTypeCustom, - MockObjectTypes.objectTypeHuman, - ) - .map { it.toObjectTypeView(selectedSources = selectedTypes) } - - val actual = searchObjectsResponse.getObjectTypeViewsForSBPage( - isWithCollection = false, - isWithBookmark = true, - excludeTypes = excludeTypes, - selectedTypes = selectedTypes - ) - - assertEquals( - expected = expected, - actual = actual - ) - - actual.forEach { - if (it.id == MockObjectTypes.objectTypePage.id) { - assertTrue { it.isSelected } - } else { - assertFalse { it.isSelected } - } - } - } -} \ No newline at end of file diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/sets/main/ObjectSetViewModelTestSetup.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/sets/main/ObjectSetViewModelTestSetup.kt index b09c8a4be6..798ad94839 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/sets/main/ObjectSetViewModelTestSetup.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/sets/main/ObjectSetViewModelTestSetup.kt @@ -12,10 +12,8 @@ import com.anytypeio.anytype.core_models.Payload import com.anytypeio.anytype.core_models.Relation import com.anytypeio.anytype.core_models.Relations import com.anytypeio.anytype.core_models.SearchResult -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.core_models.restrictions.DataViewRestrictions import com.anytypeio.anytype.domain.base.AppCoroutineDispatchers -import com.anytypeio.anytype.domain.`object`.UpdateDetail import com.anytypeio.anytype.domain.base.Either import com.anytypeio.anytype.domain.base.Result import com.anytypeio.anytype.domain.block.interactor.UpdateText @@ -27,6 +25,7 @@ import com.anytypeio.anytype.domain.dataview.interactor.CreateDataViewObject import com.anytypeio.anytype.domain.event.interactor.InterceptEvents import com.anytypeio.anytype.domain.misc.UrlBuilder import com.anytypeio.anytype.domain.`object`.ConvertObjectToCollection +import com.anytypeio.anytype.domain.`object`.UpdateDetail import com.anytypeio.anytype.domain.objects.DefaultObjectStore import com.anytypeio.anytype.domain.objects.DefaultStoreOfRelations import com.anytypeio.anytype.domain.objects.ObjectStore @@ -247,9 +246,7 @@ open class ObjectSetViewModelTestSetup { blocks = doc, details = details, relations = relations, - objectTypes = objectTypes, - dataViewRestrictions = dataViewRestrictions, - type = SmartBlockType.PAGE + dataViewRestrictions = dataViewRestrictions ) ) + additionalEvents ) diff --git a/presentation/src/test/java/com/anytypeio/anytype/presentation/types/ObjectTypeChangeViewModelTest.kt b/presentation/src/test/java/com/anytypeio/anytype/presentation/types/ObjectTypeChangeViewModelTest.kt index 418aaad288..d278f53cec 100644 --- a/presentation/src/test/java/com/anytypeio/anytype/presentation/types/ObjectTypeChangeViewModelTest.kt +++ b/presentation/src/test/java/com/anytypeio/anytype/presentation/types/ObjectTypeChangeViewModelTest.kt @@ -15,9 +15,11 @@ import com.anytypeio.anytype.domain.launch.GetDefaultPageType import com.anytypeio.anytype.domain.workspace.AddObjectToWorkspace import com.anytypeio.anytype.domain.workspace.WorkspaceManager import com.anytypeio.anytype.presentation.objects.ObjectTypeChangeViewModel +import com.anytypeio.anytype.presentation.objects.SupportedLayouts import com.anytypeio.anytype.presentation.search.ObjectSearchConstants import com.anytypeio.anytype.presentation.util.CoroutinesTestRule import com.anytypeio.anytype.test_utils.MockDataFactory +import kotlin.test.assertEquals import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay import kotlinx.coroutines.runBlocking @@ -32,7 +34,6 @@ import org.mockito.kotlin.stub import org.mockito.kotlin.times import org.mockito.kotlin.verifyBlocking import org.mockito.kotlin.verifyNoInteractions -import kotlin.test.assertEquals @ExperimentalCoroutinesApi class ObjectTypeChangeViewModelTest { @@ -103,7 +104,18 @@ class ObjectTypeChangeViewModelTest { val vm = givenViewModel() - val expectedMyTypesFilters = ObjectSearchConstants.filterObjectTypeLibrary(workspaceId) + val expectedMyTypesFilters = buildList { + addAll(ObjectSearchConstants.filterObjectTypeLibrary(workspaceId)) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) + } // TESTING @@ -141,7 +153,18 @@ class ObjectTypeChangeViewModelTest { val vm = givenViewModel() - val expectedMyTypesFilters = ObjectSearchConstants.filterObjectTypeLibrary(workspaceId) + val expectedMyTypesFilters = buildList { + addAll(ObjectSearchConstants.filterObjectTypeLibrary(workspaceId)) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) + } val expectedMyTypeKeys = ObjectSearchConstants.defaultKeysObjectType val expectedMarketplaceTypeKeys = ObjectSearchConstants.defaultKeysObjectType @@ -158,6 +181,15 @@ class ObjectTypeChangeViewModelTest { ) ) ) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) } blockRepository.stub { @@ -226,7 +258,18 @@ class ObjectTypeChangeViewModelTest { val vm = givenViewModel() - val expectedMyTypesFilters = ObjectSearchConstants.filterObjectTypeLibrary(workspaceId) + val expectedMyTypesFilters = buildList { + addAll(ObjectSearchConstants.filterObjectTypeLibrary(workspaceId)) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) + } val expectedMyTypeKeys = ObjectSearchConstants.defaultKeysObjectType val expectedMarketplaceTypeKeys = ObjectSearchConstants.defaultKeysObjectType @@ -243,6 +286,15 @@ class ObjectTypeChangeViewModelTest { ) ) ) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) } val query = MockDataFactory.randomString() @@ -387,7 +439,18 @@ class ObjectTypeChangeViewModelTest { val expectedInstalledTypeId = ObjectTypeIds.PAGE - val expectedMyTypesFilters = ObjectSearchConstants.filterObjectTypeLibrary(workspaceId) + val expectedMyTypesFilters = buildList { + addAll(ObjectSearchConstants.filterObjectTypeLibrary(workspaceId)) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) + } val expectedMyTypeKeys = ObjectSearchConstants.defaultKeysObjectType val expectedMarketplaceTypeKeys = ObjectSearchConstants.defaultKeysObjectType @@ -404,6 +467,15 @@ class ObjectTypeChangeViewModelTest { ) ) ) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) } blockRepository.stub { @@ -515,7 +587,18 @@ class ObjectTypeChangeViewModelTest { val vm = givenViewModel() - val expectedMyTypesFilters = ObjectSearchConstants.filterObjectTypeLibrary(workspaceId) + val expectedMyTypesFilters = buildList { + addAll(ObjectSearchConstants.filterObjectTypeLibrary(workspaceId)) + add( + DVFilter( + relation = Relations.RECOMMENDED_LAYOUT, + condition = DVFilterCondition.IN, + value = SupportedLayouts.editorLayouts.map { + it.code.toDouble() + } + ) + ) + } val expectedMyTypeKeys = ObjectSearchConstants.defaultKeysObjectType blockRepository.stub { diff --git a/test/core-models-stub/src/main/java/com/anytypeio/anytype/core_models/Block.kt b/test/core-models-stub/src/main/java/com/anytypeio/anytype/core_models/Block.kt index 61fe1c1146..f3dc43416f 100644 --- a/test/core-models-stub/src/main/java/com/anytypeio/anytype/core_models/Block.kt +++ b/test/core-models-stub/src/main/java/com/anytypeio/anytype/core_models/Block.kt @@ -235,13 +235,12 @@ fun StubBookmark( fun StubSmartBlock( id: Id = MockDataFactory.randomString(), - children: List = emptyList(), - type: SmartBlockType = SmartBlockType.PAGE + children: List = emptyList() ): Block = Block( id = id, children = children, fields = Block.Fields.empty(), - content = Block.Content.Smart(type = type) + content = Block.Content.Smart ) fun StubTable( diff --git a/test/core-models-stub/src/main/java/com/anytypeio/anytype/core_models/Object.kt b/test/core-models-stub/src/main/java/com/anytypeio/anytype/core_models/Object.kt index 059103c494..9bdf4530b6 100644 --- a/test/core-models-stub/src/main/java/com/anytypeio/anytype/core_models/Object.kt +++ b/test/core-models-stub/src/main/java/com/anytypeio/anytype/core_models/Object.kt @@ -36,7 +36,6 @@ fun StubObject( fun StubObjectView( root: Id, - type: SmartBlockType, blocks: List = emptyList(), details: Map = emptyMap(), relations: List = emptyList(), @@ -46,7 +45,6 @@ fun StubObjectView( root = root, blocks = blocks, details = details, - type = type, relations = relations, objectRestrictions = objectRestrictions, dataViewRestrictions = dataViewRestrictions diff --git a/test/core-models-stub/src/main/java/com/anytypeio/anytype/presentation/MockBlockFactory.kt b/test/core-models-stub/src/main/java/com/anytypeio/anytype/presentation/MockBlockFactory.kt index ad55d6b699..3d27214eb1 100644 --- a/test/core-models-stub/src/main/java/com/anytypeio/anytype/presentation/MockBlockFactory.kt +++ b/test/core-models-stub/src/main/java/com/anytypeio/anytype/presentation/MockBlockFactory.kt @@ -3,7 +3,6 @@ package com.anytypeio.anytype.presentation import com.anytypeio.anytype.core_models.Block import com.anytypeio.anytype.core_models.Block.Content.Link import com.anytypeio.anytype.core_models.Id -import com.anytypeio.anytype.core_models.SmartBlockType import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubLinkContent import com.anytypeio.anytype.presentation.MockBlockContentFactory.StubTextContent import com.anytypeio.anytype.test_utils.MockDataFactory @@ -71,7 +70,7 @@ object MockBlockFactory { Block( id = root, fields = Block.Fields(emptyMap()), - content = Block.Content.Smart(SmartBlockType.PAGE), + content = Block.Content.Smart, children = listOf(child) ), Block(