project_file_invalidator_test.dart 1.14 KB
Newer Older
1 2 3 4 5 6 7 8
// Copyright 2019 The Chromium 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:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/run_hot.dart';

9 10
import '../src/common.dart';
import '../src/context.dart';
11 12

void main() {
13
  group('ProjectFileInvalidator', () {
14
    final MemoryFileSystem memoryFileSystem = MemoryFileSystem();
15 16
    testUsingContext('Empty project', () async {
      expect(
17
        ProjectFileInvalidator.findInvalidated(lastCompiled: DateTime.now(), urisToMonitor: <Uri>[], packagesPath: ''),
18
        isEmpty);
19 20 21 22
    }, overrides: <Type, Generator>{
      FileSystem: () => memoryFileSystem,
    });

23 24 25 26
    testUsingContext('Non-existent files are ignored', () async {
      expect(
        ProjectFileInvalidator.findInvalidated(
            lastCompiled: DateTime.now(),
27 28 29
            urisToMonitor: <Uri>[Uri.parse('/not-there-anymore'),],
            packagesPath: '',
          ),
30
        isEmpty);
31 32 33 34 35
    }, overrides: <Type, Generator>{
      FileSystem: () => memoryFileSystem,
    });
  });
}