Files
buzz/mobile/test/shared/me/me_groups_test.dart
klopez4212 634f48a8bd Mobile: open Solo chats with Bestie and workspace controls (#8884)
Mobile New chat now opens directly with the synced Bestie selected. The
first send creates and names the chat; leaving an empty draft creates
nothing. New and existing Solo chats can select or clear a workspace
from the header popover, with a checkmark for the active choice and a No
Workspace option. Workspace and agent controls have separate iOS glass
surfaces, Bestie stays at the far right, and Back uses a chevron. The
agent sheet fits its list, with scrolling for long lists. Workspace
creation stays in the Home New menu.

The New menu groups Solo above Team. Android expands across the full
control row; iOS keeps its native menu while Search and Bestie merge
into New through Liquid Glass, with synchronized icon motion and the
residual glass fading away. Empty workspaces use a compact, muted
message.

Validation: 4,055 mobile tests passed (34 skipped), static analysis
passed, and native menu checks passed. Earlier physical-device previews
and the iPhone New-menu animation were visually approved before this
consolidation.

This PR consolidates the controls previously developed in #8891 into the
existing draft/first-send implementation. The New menu animations,
attachment handling, and durable retries remain in this PR. The combined
controls have widget interaction coverage; the combined build has not
yet had a new physical-device walkthrough.

Current combined controls below are Android Flutter widget renders with
fixture data, not device screenshots. Images are GitHub attachments
only.

| New conversation | Workspace popover | Compact agent sheet |
| --- | --- | --- |
| ![New chat
composer](https://github.com/user-attachments/assets/f9ea2a16-342e-4cea-a436-0777ff5e37aa)
| ![Checked workspace
popover](https://github.com/user-attachments/assets/80eb7a71-e424-4188-86d7-eb6292b148bf)
| ![Content-sized agent
sheet](https://github.com/user-attachments/assets/be608383-0188-4339-b56b-924085137452)
|

Empty workspace widget preview (unchanged):

![Compact empty workspace
message](https://github.com/user-attachments/assets/387c0729-dea3-4250-bb54-afc4e61b54a7)

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-11-01 21:40:30 +00:00

113 lines
3.6 KiB
Dart

import 'dart:convert';
import 'package:flutter_test/flutter_test.dart';
import 'package:buzz/shared/me/me_groups.dart';
void main() {
test(
'moving to No workspace removes the old assignment and retains the chat',
() {
const groups = MeGroups(
groups: [
{'id': 'work', 'name': 'Work', 'defaultTemplateId': ''},
],
channels: ['chat', 'other'],
assignments: {'chat': 'work', 'other': 'work'},
);
final unfiled = groups.place('chat', clearGroup: true);
expect(unfiled.assignments, {'other': 'work'});
expect(unfiled.channels, ['chat', 'other']);
expect(
unfiled.place('chat', group: 'work').assignments,
groups.assignments,
);
},
);
const origin = 'https://buzz.block.builderlab.xyz';
const channel = '11111111-1111-4111-8111-111111111111';
Map<String, dynamic> record() => {
'version': 1,
'community': origin,
'deleted': false,
'value': {
'type': 'groups',
'id': 'me',
'groups': [
{
'id': 'project-one',
'name': 'Mobile',
'defaultTemplateId': 'me-section-one',
},
],
'assignments': {channel: 'project-one'},
'channels': [channel],
},
};
test('reads desktop groups and preserves defaults when placing a chat', () {
final source = record();
final groups = MeGroups.decode(jsonEncode(source), origin);
expect(groups.groups.single['defaultTemplateId'], 'me-section-one');
expect(jsonDecode(groups.place(channel).encode(origin)), source);
expect(
MeGroups.coordinate(origin),
'buzz-me-kit-v1:https%3A%2F%2Fbuzz.block.builderlab.xyz:groups:me',
);
});
test('rejects another community and independent Messages organization', () {
expect(
() => MeGroups.decode(jsonEncode(record()), 'https://other.test'),
throwsFormatException,
);
final source = record();
(source['value'] as Map)['id'] = 'messages';
expect(
() => MeGroups.decode(jsonEncode(source), origin),
throwsFormatException,
);
});
test(
'tombstones clear personal placement without inferring old sessions',
() {
final source = record()..['deleted'] = true;
expect(MeGroups.decode(jsonEncode(source), origin).channels, isEmpty);
},
);
test('rejects duplicate placement and missing project references', () {
final source = record();
(source['value'] as Map)['channels'] = [channel, channel];
expect(
() => MeGroups.decode(jsonEncode(source), origin),
throwsFormatException,
);
(source['value'] as Map)['channels'] = [channel];
(source['value'] as Map)['assignments'] = {channel: 'gone'};
expect(
() => MeGroups.decode(jsonEncode(source), origin),
throwsFormatException,
);
});
test('project names use the editors grapheme limit', () {
for (final character in ['🌳', '👨‍👩‍👧‍👦', 'e\u0301']) {
MeGroups groups(int count) => MeGroups(
groups: [
{'id': 'project', 'name': character * count, 'defaultTemplateId': ''},
],
);
final encoded = groups(120).encode(origin);
expect(
MeGroups.decode(encoded, origin).groups.single['name'],
character * 120,
);
expect(() => groups(121).encode(origin), throwsFormatException);
}
});
test('capacity is measured in UTF-8 bytes before publishing', () {
final groups = MeGroups(
groups: List.generate(
100,
(i) => {'id': 'g$i', 'name': '🌳' * 60, 'defaultTemplateId': ''},
),
);
expect(() => groups.encode(origin), throwsFormatException);
});
}