mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
refactor: fav and workspace (#3837)
* refactor: workspace * chore: update collab rev * test: add data migration test * fix: test * fix: tauri build * test: fix bloc test * test: fix bloc test * test: fix bloc test * chore: restore magic codde
This commit is contained in:
@ -126,7 +126,7 @@ void main() {
|
||||
..add(const DocumentEvent.initial());
|
||||
await blocResponseFuture();
|
||||
|
||||
final workspaceSetting = await FolderEventGetCurrentWorkspace()
|
||||
final workspaceSetting = await FolderEventGetCurrentWorkspaceSetting()
|
||||
.send()
|
||||
.then((result) => result.fold((l) => l, (r) => throw Exception()));
|
||||
workspaceSetting.latestView.id == document1.id;
|
||||
@ -147,7 +147,7 @@ void main() {
|
||||
final grid = bloc.state.latestCreatedView;
|
||||
assert(grid!.name == "grid 2");
|
||||
|
||||
var workspaceSetting = await FolderEventGetCurrentWorkspace()
|
||||
var workspaceSetting = await FolderEventGetCurrentWorkspaceSetting()
|
||||
.send()
|
||||
.then((result) => result.fold((l) => l, (r) => throw Exception()));
|
||||
workspaceSetting.latestView.id == grid!.id;
|
||||
@ -158,7 +158,7 @@ void main() {
|
||||
..add(const DocumentEvent.initial());
|
||||
await blocResponseFuture();
|
||||
|
||||
workspaceSetting = await FolderEventGetCurrentWorkspace()
|
||||
workspaceSetting = await FolderEventGetCurrentWorkspaceSetting()
|
||||
.send()
|
||||
.then((result) => result.fold((l) => l, (r) => throw Exception()));
|
||||
workspaceSetting.latestView.id == document.id;
|
||||
|
@ -14,7 +14,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('initi home screen', () async {
|
||||
final workspaceSetting = await FolderEventGetCurrentWorkspace()
|
||||
final workspaceSetting = await FolderEventGetCurrentWorkspaceSetting()
|
||||
.send()
|
||||
.then((result) => result.fold((l) => l, (r) => throw Exception()));
|
||||
await blocResponseFuture();
|
||||
@ -27,7 +27,7 @@ void main() {
|
||||
});
|
||||
|
||||
test('open the document', () async {
|
||||
final workspaceSetting = await FolderEventGetCurrentWorkspace()
|
||||
final workspaceSetting = await FolderEventGetCurrentWorkspaceSetting()
|
||||
.send()
|
||||
.then((result) => result.fold((l) => l, (r) => throw Exception()));
|
||||
await blocResponseFuture();
|
||||
@ -52,6 +52,7 @@ void main() {
|
||||
await FolderEventSetLatestView(ViewIdPB(value: latestView.id)).send();
|
||||
await blocResponseFuture();
|
||||
|
||||
assert(homeBloc.state.workspaceSetting.latestView.id == latestView.id);
|
||||
final actual = homeBloc.state.workspaceSetting.latestView.id;
|
||||
assert(actual == latestView.id);
|
||||
});
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ void main() {
|
||||
test('assert initial apps is the build-in app', () async {
|
||||
final menuBloc = MenuBloc(
|
||||
user: testContext.userProfile,
|
||||
workspace: testContext.currentWorkspace,
|
||||
workspaceId: testContext.currentWorkspace.id,
|
||||
)..add(const MenuEvent.initial());
|
||||
await blocResponseFuture();
|
||||
|
||||
@ -22,7 +22,7 @@ void main() {
|
||||
test('reorder apps', () async {
|
||||
final menuBloc = MenuBloc(
|
||||
user: testContext.userProfile,
|
||||
workspace: testContext.currentWorkspace,
|
||||
workspaceId: testContext.currentWorkspace.id,
|
||||
)..add(const MenuEvent.initial());
|
||||
await blocResponseFuture();
|
||||
menuBloc.add(const MenuEvent.createApp("App 1"));
|
||||
|
@ -27,7 +27,7 @@ class AppFlowyUnitTest {
|
||||
late UserProfilePB userProfile;
|
||||
late UserBackendService userService;
|
||||
late WorkspaceService workspaceService;
|
||||
late List<WorkspacePB> workspaces;
|
||||
late WorkspacePB workspace;
|
||||
|
||||
static Future<AppFlowyUnitTest> ensureInitialized() async {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
@ -68,12 +68,12 @@ class AppFlowyUnitTest {
|
||||
);
|
||||
}
|
||||
|
||||
WorkspacePB get currentWorkspace => workspaces[0];
|
||||
WorkspacePB get currentWorkspace => workspace;
|
||||
|
||||
Future<void> _loadWorkspace() async {
|
||||
final result = await userService.getWorkspaces();
|
||||
final result = await userService.getCurrentWorkspace();
|
||||
result.fold(
|
||||
(value) => workspaces = value,
|
||||
(value) => workspace = value,
|
||||
(error) {
|
||||
throw Exception(error);
|
||||
},
|
||||
|
Reference in New Issue
Block a user