sdk_web_configuration_test.dart 1.67 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:dwds/dwds.dart';
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/isolated/sdk_web_configuration.dart';

import '../src/common.dart';

void main() {
14
  late FileSystem fileSystem;
15 16

  group('Flutter SDK configuration for web', () {
17
    late SdkConfiguration configuration;
18 19 20 21

    setUp(() async {
      fileSystem = MemoryFileSystem.test();
      fileSystem.directory('HostArtifact.flutterWebSdk').createSync();
22 23
      fileSystem.file('HostArtifact.webPlatformDDCKernelDill').createSync();
      fileSystem.file('HostArtifact.webPlatformDDCSoundKernelDill').createSync();
24 25 26 27 28 29 30 31 32 33 34 35 36
      fileSystem.file('HostArtifact.flutterWebLibrariesJson').createSync();

      final SdkWebConfigurationProvider provider =
        SdkWebConfigurationProvider(Artifacts.test(fileSystem: fileSystem));
      configuration = await provider.configuration;
    });

    testWithoutContext('can be validated', () {
      SdkWebConfigurationProvider.validate(configuration, fileSystem: fileSystem);
    });

    testWithoutContext('is correct', () {
      expect(configuration.sdkDirectory, 'HostArtifact.flutterWebSdk');
37
      expect(configuration.weakSdkSummaryPath, 'HostArtifact.webPlatformDDCKernelDill');
38
      expect(configuration.soundSdkSummaryPath, 'HostArtifact.webPlatformDDCSoundKernelDill');
39 40 41 42 43
      expect(configuration.librariesPath, 'HostArtifact.flutterWebLibrariesJson');
      expect(configuration.compilerWorkerPath, isNull);
    });
  });
}