Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

1.3 KB
Raw Blame
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/state/app_state.dart';

import 'super_tab_launch_test.dart' show SuperTabLaunchFixture, tabId;

void main() {
  test(
    'new collaborator joins without machine admission or Team setup',
    () async {
      final f = SuperTabLaunchFixture();
      f.app.status = AppStatus.authenticated;
      f.app.teamAccountHereForTest = true;
      f.connection.server.state['people'] = [
        {'id': 'boss', 'email': '[email protected]', 'role': 'owner'},
        {'id': 'owner', 'email': '[email protected]', 'role': 'collaborator'},
      ];
      f.connection.server.state['ownerId'] = 'boss';
      var prompts = 0;
      f.app.addListener(() {
        final request = f.app.joinAccountRequest;
        if (request != null && !request.answered) {
          prompts++;
          request.complete(false);
        }
      });
      await f.app.addMachineOnJoin(tabId, role: 'collaborator');
      expect(
        f.connection.server.posts.where(
          (post) => (post['command'] as Map)['type'] == 'machine.contribute',
        ),
        isEmpty,
      );
      expect(
        f.connection.calls.where(
          (call) =>
              call.$1 == 'super_tabs' && call.$2['action'] == 'teamSetupCheck',
        ),
        isEmpty,
      );
      expect(prompts, 1);
      f.dispose();
    },
  );
}