import 'dart:io';

import 'package:dart_framework/core/application.dart';
import 'package:dart_framework/dart_framework.dart';
import 'package:dart_framework/utils/os_startup.dart';
import 'package:dart_framework/utils/system_util.dart';
import 'package:test/test.dart';
import 'package:dart_framework/platform/isolate_manager.dart' as isolate;

void main() {
  final appID = 'com.toki-labs.dartframework';

  group('Application', () {
    final awesome = Awesome();

    setUp(() {
      // Additional setup goes here.
      print('Set up!!');
      Application('dartframework', appID, () async {}, (error, stack) {});
    });

    test('First Test', () {
      expect(awesome.isAwesome, isTrue);
    });
  });

  group('Isolate', () {
    setUp(() {
      // Additional setup goes here.
      print('Set up!!');
    });

    test('test', () async {
      isolate.test();
    });
  });

  group('OSStart', () {
    setUp(() {
      // Additional setup goes here.
      print('Set up!!');
    });

    test('OSStart test', () async {
      var isRegisted = await OSStartup.isRegistedStartup(appID);
      expect(isRegisted, isFalse);
      print('isRegisted: $isRegisted');

      var result = await OSStartup.registStartup(
          Platform.resolvedExecutable, appID,
          logStandardFilePath: '$dataPath\\startup_log.txt');
      expect(result, isTrue);
      print('Regist Result: $result');

      /*expect(await OSStartup.unregistStartup(appID), isTrue);

      expect(await OSStartup.isRegistedStartup(appID), isFalse);*/
    });
  });
}
